On Tue, Apr 28, 2009 at 1:56 AM, Clemens Hermann <goo...@clhe.de> wrote: > > Christoph , > >> > p.pager(controller='ctrl', action='act') >> >> If I understand the explicit stuff correctly then this should be the right >> way to use it. Right? > > depends on what you want to do :). > My patch frees you from providing the controller/action explicitly as > they can be pulled out of a regular pylons app stack (they were not > present in your code sample though). > If you provide the controller/action as above then even the current > implementation of the paginator works perfectly with explicite=True. > However I'd consider it bad practice to specify the same controller/ > action name at two distinct places (the controller/action themselves > and the call to Page/pager). > > explicit=True disables two things: > 1. Route Memory - the controller, action, etc. of the current request > are not reused if missing (e.g. in a call to url_for). > 2. Implicit Defaults - if controller/action are missing they are no > longer replaced by controller='content' and action='index'. > > (1) was the reason for which the paginator failed in the first place > in a regular pylons application with explicit=True because the call to > url_for in the paginator relied on this feature. > (2) was the reason for which your code sample failed as the controller/ > action were missing. > >> I'll send Mike Orr a patch bundle including your work.
I still have to analyze Christoph's patches, but I do want to say, I want to get away from magic as much as we can. That means trying to get the paginator to work without route memory. For a while I had an implementation that let you pass in extra args and they would be held and used to generate links to other pages. Then I went with my current structure, which uses the paginator to just get the page numbers but calls url() outside it in a Mako function. So one way might be to just depend on pylons.url (assuming it can be imported), but that would make the paginator Pylons-specific. And I still think you'd have to pass in extra args to get around the lack of route memory. You could put a paginate subclass under webhelpers.pylons, which would keep the Pylons-specific code separate from the generic code. I think Ben told me url() uses route memory in one situation but not in another, but i can't remember what those are. -- Mike Orr <sluggos...@gmail.com> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@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 -~----------~----~----~----~------~----~------~--~---