Ñò ±p“Hc @s¾dZddkZeideƒddkZddklZddklZei dei ƒZ ddddd„Z d efd „ƒYZd efd „ƒYZd efd„ƒYZdS(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ÿÿÿÿNsXThe webhelpers.pagination package is deprecated. Please migrate to webhelpers.paginate.(trequest_config(t get_wrappers page=(\d+)i c Ks“|djoçtƒ}t|dƒo|iidƒ}n|dj o-tid|ƒot|ƒ}qÙd}nd|djoVt|dƒoFtit|i iddƒƒ}|ot|i ƒdƒ}qÙn|djo d}qôn|djo g}nt |||Ž}|pt |ƒ}nt |||ƒ}|djp|t |ƒjo g} n||ii|ii!} || fS( 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_dicttpages\d+itenviront QUERY_STRINGtN(tNoneRthasattrRtgettretmatchtintt find_pageRtgroupsRtlent Paginatortcurrentt first_itemt last_item( t collectionRtper_paget item_countt query_argstoptionstconfigt page_matcht paginatortsubset((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytpaginate s2-          RcBsYeZdZddd„Zd„ZeeƒZd„Zd„Zd„Zd„Z RS( stTracks 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 icCs(||_||_h|_||_dS(s5Initialize a Paginator with the item count specified.N(Rtitems_per_pagetpagest current_page(tselfRRR ((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt__init__‚s   cCsd}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. cSs|t|iƒS(N(R R (R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytfget’scSs]t|tƒo |i|jotdƒ‚nt|ƒ}||jo|pd|_dS(NsPage/Paginator mismatchi(t isinstancetPageRtAttributeErrorR R (R!R((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytfset”s  (tlocals(tdocR#R'((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR‰s  cCs/|idjodS|id|idSdS(Nii(RR(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt__len__œsccs-x&tdt|ƒƒD]}||VqWdS(Ni(trangeR(R!ti((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt__iter__¢scCs{|djot|ƒ|}n|djo d}n||jo|djo td‚n|ii|t||ƒƒS(Nislist index out of range(Rt IndexErrorRt setdefaultR%(R!tindex((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt __getitem__¦s    cCs-|djo|t|ƒdjotStS(Nii(RtTruetFalse(R!tvalue((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt __contains__³s$( t__name__t __module__t__doc__R"RtpropertyR*R-R1R5(((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyRps    R%cBsïeZdZd„Zd„Zd„Zd„Zd„ZeeƒZd„Z ee ƒZ d„Z ee ƒZ d„Z ee ƒZ d „Z ee ƒZ d „Z ee ƒZ d „ZeeƒZd d „Zd„ZRS(scRepresents a single page from a paginated set. Deprecated - use paginate module. cCs||_t|ƒ|_dS(s>Create new Page for given ``paginator`` with index ``number``.N(RR tnumber(R!RR:((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR"Às cCs|iS(N(R:(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt__int__ÅscCs#|i|ijo|i|ijS(N(RR:(R!R((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt__eq__ÈscCst|i|iƒS(N(tcmpR:(R!R((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt__cmp__ËscCsd}d„}tƒS(Ns0Offset of the page, useful for database queries.cSs|ii|iS(N(RRR:(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR#Ðs(R((R)R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytoffsetÎs cCsd}d„}tƒS(Ns)The number of the first item in the page.cSs|iS(N(R?(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR#×s(R((R)R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyRÕs cCsd}d„}tƒS(Ns(The number of the last item in the page.cSs$t|ii|id|iiƒS(Ni(tminRRR:R(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR#Þs(R((R)R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyRÜs cCsd}d„}tƒS(Ns.Boolean indiciating if this page is the first.cSs||idjS(Ni(R(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR#æs(R((R)R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytfirstäs cCsd}d„}tƒS(Ns,Boolean indicating if this page is the last.cSs||idjS(Niÿÿÿÿ(R(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR#ís(R((R)R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytlastës cCsd}d„}tƒS(Ns+Previous page if it exists, None otherwise.cSs!|iodS|i|idS(Ni(RARRR:(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR#ôs (R((R)R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytpreviousòs cCsd}d„}tƒS(Ns'Next page if it exists, None otherwise.cSs!|iodS|i|idS(Ni(RBRRR:(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR#ýs (R((R)R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytnextûs icCs t||ƒS(N(tWindow(R!tpadding((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pytwindowscCs t|iƒS(N(tstrR:(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt__repr__s(R6R7R8R"R;R<R>R?R9RRRARBRCRDRGRI(((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR%¸s*            REcBsSeZdZdd„Zd„ZeeƒZd„ZeeƒZd„ZRS(s[Represents ranges around a given page. Deprecated - use paginate module. icCs"|i|_||_||_dS(s9Create new Window object for given ``page``, ``padding``.N(RRRF(R!RRF((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR"s  cCsd}d„}d„}tƒS(NsGWindow padding (the number of pages on either side of the window page).cSs©||_|djo d|_n|ii|i}||ijo|i|p |id|_|ii|i}||ijo|i|p |id|_dS(Niiÿÿÿÿ(t_paddingRR:RRARB(R!RFtfirst_page_in_windowtlast_page_in_window((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR's  cSs|iS(N(RJ(R!((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR##s(R((R)R'R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyRFs cCsd}d„}tƒS(Ns-A list of Page objects in the current window.cSs?g}t|ii|iidƒD]}||i|q$~S(Ni(R+RAR:RBR(R!t_[1]t page_number((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR#*s(R((R)R#((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyR(s cCs@|i|ijotdƒ‚nt|iid|idƒS(NsWindow/paginator mismatchRFi(RR&RERRDRF(R!RG((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyt__add__0s(R6R7R8R"RFR9RRO(((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyRE s   (R8twarningstwarntDeprecationWarningR troutesRtwebhelpers.pagination.ormRtcompiletIR RRtobjectRR%RE(((sB/usr/lib/python2.6/site-packages/webhelpers/pagination/__init__.pyts    OHR