Moin, Clemens... Am Donnerstag, 16. April 2009 18:49:10 schrieb Clemens Hermann: > if routes.Mapper is configured with explicit=True (as recommended) > then webhelpers.paginate.Page._pagerlink fails. The reason for this is > that _pagerlink relies on route memory which is not present in case of > explicit=True.
Thanks, I didn't even notice that. I can reproduce the problem. > This patch fixes the issue: http://paste.pocoo.org/show/112812/ Not for me yet. This is what I tried in ipython: ================================ >>> from routes import Mapper; mapper=Mapper(explicit=True); mapper.connect(':controller'); from webhelpers import paginate; p=paginate.Page(range(100)); >>> p.pager() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/chaas/projekte/pylons/webhelpers/<ipython console> in <module>() /home/chaas/projekte/pylons/webhelpers/webhelpers/paginate.pyc in pager(self, format, page_param, partial_param, show_if_single_page, separator, onclick, symbol_first, symbol_last, symbol_previous, symbol_next, link_attr, curpage_attr, dotdot_attr, **kwargs) 696 697 # Replace ~...~ in token format by range of pages --> 698 result = re.sub(r'~(\d+)~', _range, format) 699 700 # Interpolate '%' variables /usr/lib/python2.5/re.pyc in sub(pattern, repl, string, count) 148 if a callable, it's passed the match object and must return 149 a replacement string to be used.""" --> 150 return _compile(pattern, 0).sub(repl, string, count) 151 152 def subn(pattern, repl, string, count=0): /home/chaas/projekte/pylons/webhelpers/webhelpers/paginate.pyc in _range(regexp_match) 669 else: 670 text = '%s' % (thispage,) --> 671 nav_items.append( _pagerlink(thispage, text) ) 672 673 # Insert dots if there are pages between the displayed /home/chaas/projekte/pylons/webhelpers/webhelpers/paginate.pyc in _pagerlink(pagenr, text) 600 config = request_config() 601 if config.mapper.explicit: --> 602 for k, v in config.mapper_dict.items(): 603 link_params[k] = v 604 print link_params /usr/lib/pymodules/python2.5/routes/__init__.pyc in __getattr__(self, name) 12 13 def __getattr__(self, name): ---> 14 return getattr(self.__shared_state, name) 15 16 def __setattr__(self, name, value): AttributeError: 'thread._local' object has no attribute 'mapper_dict' ================================ I'm no Routes god so I'm not sure where this is coming from. Do you have an idea? Cheers Christoph
signature.asc
Description: This is a digitally signed message part.