Ñò ±p“Hc @ s¾ d Z d d k Z e i d e ƒ d d k Z d d k l Z d d k l Z e i d e i ƒ Z d d d d d „ Z d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d S( sé Pagination for Collections and ORMs - Deprecated: Use paginate module. The Pagination module aids in the process of paging large collections of objects. It can be used macro-style for automatic fetching of large collections using one of the ORM wrappers, or handle a large collection responding to standard Python list slicing operations. These methods can also be used individually and customized to do as much or little as desired. The Paginator itself maintains pagination logic associated with each page, where begins, what the first/last item on the page is, etc. Helper functions hook-up the Paginator in more conveinent methods for the more macro-style approach to return the Paginator and the slice of the collection desired. iÿÿÿÿNsX The webhelpers.pagination package is deprecated. Please migrate to webhelpers.paginate.( t request_config( t get_wrappers page=(\d+)i c K s“ | d j oç t ƒ } t | d ƒ o | i i d ƒ } n | d j o- t i d | ƒ o t | ƒ } qÙ d } nd | d j oV t | d ƒ oF t i t | i i d d ƒ ƒ } | o t | i ƒ d ƒ } qÙ n | d j o d } qô n | d j o g } n t | | | Ž } | p t | ƒ } n t | | | ƒ } | d j p | t | ƒ j o g } n | | i i | i i !} | | f S( s# Paginate a collection of data. Deprecated: Use paginate *package*. If the collection is a list, it will return the slice of the list along with the Paginator object. If the collection is given using an ORM, the collection argument must be a partial representing the function to be 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 # list/tuple person_paginator, person_set = paginate(Person, page=1) set_count = int(person_paginator.current) total_pages = len(person_paginator) Current ORM support is limited to SQLObject and SQLAlchemy. You can use any ORM you'd like with the Paginator as it will give you the offset/limit data necessary to make your own query. If you fail to pass in a page value, paginate will attempt to find a page value in the QUERY_STRING from environ, or the Routes match dict. This feature only works if routes was used to resolve the URL. Example:: # Using an SQLAlchemy object with assign_mapper under Pylons # with an order_by passed in c.paginator, c.people = paginate(model.Person, order_by=[model.Person.c.date]) **WARNING:** Unless you pass in an item_count, a count will be performed on the collection every time paginate is called. If using an ORM, it's suggested that you count the items yourself and/or cache them. t mapper_dictt pages \d+i t environt QUERY_STRINGt N( t NoneR t hasattrR t gett ret matcht intt find_pageR t groupsR t lent Paginatort currentt first_itemt last_item( t collectionR t per_paget item_countt query_argst optionst configt page_matcht paginatort subset( ( sB /usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt paginate s2 - R c B sY e Z d Z d d d „ Z d „ Z e e ƒ Z d „ Z d „ Z d „ Z d „ Z RS( st Tracks paginated data sets, and supplies common pagination operations. Deprecated - use paginate module. The Paginator tracks data associated with pagination of groups of data, as well as supplying objects and methods that make dealing with paginated results easier. A Paginator supports list operations, including item fetching, length, iteration, and the 'in' operation. Each item in the Paginator is a Page object representing data about that specific page in the set of paginated data. As with the standard Python list, the Paginator list index starts at 0. i i c C s( | | _ | | _ h | _ | | _ d S( s5 Initialize a Paginator with the item count specified.N( R t items_per_paget pagest current_page( t selfR R R ( ( sB /usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt __init__‚ s c C s d } d „ } d „ } t ƒ S( Nsø Page object currently being displayed. When assigning to the current page, it will set the page number for this page and create it if needed. If the page is a Page object and does not belong to this paginator, an AttributeError will be raised. c S s | t | i ƒ S( N( R R ( R! ( ( sB /usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt fget’ s c S s] t | t ƒ o | i | j o t d ƒ ‚ n t | ƒ } | | j o | p d | _ d S( Ns Page/Paginator mismatchi ( t isinstancet PageR t AttributeErrorR R ( R! R ( ( sB /usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt fset” s ( t locals( t docR# R' ( ( sB /usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR ‰ s c C s/ | i d j o d S| i d | i d Sd S( Ni i ( R R ( R! ( ( sB /usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt __len__œ s c c s- x&