Getting the following error following the doc examples: Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 >>> items = range(1,24) >>> import webhelpers.paginate >>> page2 = webhelpers.paginate.Page(items, page=2, items_per_page=10) >>> page2.pager() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\python25\lib\site-packages\WebHelpers-0.6-py2.5.egg\webhelpers\pagina te.py", line 688, in pager result = re.sub(r'~(\d+)~', _range, format) File "C:\Python25\lib\re.py", line 150, in sub return _compile(pattern, 0).sub(repl, string, count) File "c:\python25\lib\site-packages\WebHelpers-0.6-py2.5.egg\webhelpers\pagina te.py", line 661, in _range nav_items.append( _pagerlink(thispage, text) ) File "c:\python25\lib\site-packages\WebHelpers-0.6-py2.5.egg\webhelpers\pagina te.py", line 597, in _pagerlink link_url = url_for(**link_params) File "c:\python25\lib\site-packages\Routes-1.9.2-py2.5.egg\routes\util.py", li ne 166, in url_for encoding = config.mapper.encoding File "c:\python25\lib\site-packages\Routes-1.9.2-py2.5.egg\routes\__init__.py" , line 14, in __getattr__ return getattr(self.__shared_state, name) AttributeError: 'thread._local' object has no attribute 'mapper'
On Wed, Jul 9, 2008 at 8:59 AM, Pavel Skvazh <[EMAIL PROTECTED]> wrote: > > I'm not sure either. You've got a lot of use cases covered already. > > Here's what i do: > > collection = Companies.list(limit, start) > c.companies = h.Page(collection['items'], page, limit, > collection['total']) > return render('/portal/companies/companies.mako') > > Then I've got template: > % for company in c.companies.collection: > % endfor > > ${c.companies.pager('Page: ~1~', 'id')} > > Since there's appears to be no way to just draw the paginator without > initing Page, that`s the way to do it for now. > Probably it'll make sense to add this > > On Jul 9, 4:09 pm, Christoph Haas <[EMAIL PROTECTED]> wrote: > > Hi, Pavel... > > > > On Mittwoch, 9. Juli 2008, Pavel Skvazh wrote: > > > > > I'd like to share a use case with paginate. > > > I've got a model that serves query results in the format I need. It > > > manages starts and limits, includes [totalrow] property so I just need > > > paginate to draw a nice paging bar. > > > > > Everything works fine, but one line messes it up for me. > > > > > self.items = list(self.collection[self.first_item-1:self.last_item]) > > > > > Here it takes only the range from the passed array. My situation > > > implies that I've already got full array fetched from the database, so > > > I need it just to be left intact. > > > > > so I changed it to self.items = list(self.collection) and it works > > > like a charm. > > > > Why do you do that? If you just use the .pager() method to draw the > paging > > bar then you shouldn't need the self.items there (unless you use it > > somewhere else). However I think this case is kind of special and I'm > > hesitating to add that to the code right away. > > > > Cheers > > Christoph > > > > signature.asc > > 1KDownload > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---