Author: justi9
Date: 2008-01-09 14:40:34 -0500 (Wed, 09 Jan 2008)
New Revision: 1544
Modified:
mgmt/cumin/python/cumin/widgets.py
mgmt/notes/justin-todo.txt
Log:
A little optimization of the pageset boundary logic.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-09 19:31:42 UTC (rev 1543)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-09 19:40:34 UTC (rev 1544)
@@ -268,20 +268,14 @@
self.page_size = 15
self.pageset_size = 5
- # Another name for this would be get_page_bounds
def get_bounds(self, session):
page = self.__page.get(session)
- return (self.page_size * page, self.page_size * (page + 1))
+ return self.page_size * page, self.page_size * (page + 1)
def get_pageset_bounds(self, session):
pageset = self.__pageset.get(session)
+ return self.pageset_size * pageset, self.pageset_size * (pageset + 1)
- start = self.pageset_size * pageset
- end = self.pageset_size * (pageset + 1)
- page_count = self.get_page_count(session)
-
- return start, min(end, page_count)
-
def set_count(self, session, count):
return self.__count.set(session, count)
@@ -358,8 +352,9 @@
count = self.__count.get(session)
start, end = self.get_pageset_bounds(session)
+ page_count = self.get_page_count(session)
- return range(start, end)
+ return range(start, min(end, page_count))
def render_item_class_attr(self, session, page):
if self.__page.get(session) == page:
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-01-09 19:31:42 UTC (rev 1543)
+++ mgmt/notes/justin-todo.txt 2008-01-09 19:40:34 UTC (rev 1544)
@@ -26,14 +26,12 @@
- Add sort direction icon
- - Deal with large numbers of pages in paginators
-
- Change first-click sort to desc for number fields
- - Handle no pages in paginator
-
- Column justification
+ - Validate paginator current page and reset as necessary
+
* Div by zero error in queues view
Deferred