Hi, Max…

I'm in charge of the paginate code. Just didn't pay close attention to
the pylons-devel mailing list for a while. So excuse the late reply.

Am 01.07.2010 14:44, schrieb Max Sinelnikov:
> I'm working on a pylons project and found a problem with
> webhelpers.paginate.Page._pagerlink. I'm using webhelpers-1.0 from
> Debian Lenny backports,  webhelpers.paginate.__version__ says '0.3.7'.
> My routes.Mapper is configured with explicit=True.
> I want for urls like /admin/user/list/page2 (not like
> /admin/user/list?page=2), so I configured my routes:
> 
> map.connect('/{controller}/{action}/page{page}', requirements={'page':
> '\d{1,5}'})
> 
> And now pager generates invalid urls. This happens when
> pager._pagerlink updates link_params using config.mapper_dict and
> link_param['page'] overrides.

I've always been confused by the internals of routes.Mapper honestly.

> The solution is simple:
> --- /usr/lib/pymodules/python2.5/webhelpers/paginate.py       2010-03-19
> 10:40:15.000000000 +0600
> +++ /usr/lib/pymodules/python2.5/webhelpers/paginate.py.new   2010-07-01
> 19:33:10.000000000 +0700
> @@ -724,7 +724,8 @@
>          if config.mapper.explicit:
>              if hasattr(config, 'mapper_dict'):
>                  for k, v in config.mapper_dict.items():
> -                    link_params[k] = v
> +                    if k != self.page_param:
> +                        link_params[k] = v
> 
>          # Create the URL to load a certain page
>          link_url = url_for(**link_params)

So you only pass the argument through to the mapper if it's not the
page_param itself ('page' by default)? Why does that work? And how is
page{page} in a route different from page={page} in this case?

 Christoph

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-de...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to