Commits

Anonymous committed ed9f81f

[svn] * WARNING: paginate now takes arguments intended for the collection object as
query_args. This could affect backwards compatibility. This fixes a common
issue that non-keyword arguments passed into paginate get eaten by paginate's
keyword arguments instead of being in *args to go on to the collection.

Comments (0)

Files changed (2)

 WebHelpers ChangeLog
 
 0.2.3 (**svn**)
+* WARNING: paginate now takes arguments intended for the collection object as
+  query_args. This could affect backwards compatibility. This fixes a common
+  issue that non-keyword arguments passed into paginate get eaten by paginate's
+  keyword arguments instead of being in *args to go on to the collection.
 * Added environ checking with Routes so that page will be automatically pulled
   out of the query string, or from the Routes match dict if available.
 * Added checking for objects that had assign_mapper applied to them.

webhelpers/pagination/__init__.py

 
 find_page = re.compile('page=(\d+)', re.I)
 
-def paginate(collection, page=None, per_page=10, item_count=None, *args,
-             **options):
+def paginate(collection, page=None, per_page=10, item_count=None, 
+             query_args=None, **options):
     """Paginate a collection of data
     
     If the collection is a list, it will return the slice of the list along
     used that will generate the proper query and extend properly for the
     limit/offset.
     
+    query_args will be passed to the partial and is for use in generating
+    limiting conditions that your collection object may take, the remaining
+    unused keyword arguments will also be passed into the collection object.
+    
     Example::
     
         # In this case, Person is a SQLObject class, or it could be a 
         if page is None:
             page = 0
     
-    collection = get_wrapper(collection, *args, **options)
+    collection = get_wrapper(collection, *query_args, **options)
     if not item_count:
         item_count = len(collection)
     paginator = Paginator(item_count, per_page, page)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.