« Return to Thread: Specialized URL traversal.. Best way?

Re: Specialized URL traversal.. Best way?

by Marius Gedminas :: Rate this Message:

Reply to Author | View in Thread

On Tue, Jan 03, 2006 at 05:37:30PM -0500, Wade Leftwich wrote:

> Marius Gedminas wrote:
> > On Thu, Dec 29, 2005 at 11:22:28PM -0700, Jeff Shell wrote:
> >>Again, this is to have URLs like:
> >>
> >>myapp/@@tags/zope/viewlet
>
> How about this? It gives
> zope.app.publication.publicationtraverse.PublicationTraverse.traverseName()
> some extra work, but it doesn't mess with the request and leaves
> request.URL reflecting the entire "path".
>
> ###
> class BrowserViewStopTraversal(BrowserView):
>     implements(IPublishTraverse)
>
>     def __init__(self, context, request):
>         self.context = context
>         self.request = request
>         self.traverse_subpath = []
>
>     def publishTraverse(self, request, name):
>         self.traverse_subpath.append(name)
>         return self
>
>     def __call__(self):
>         """Just for example"""
>         return ("traverse_subpath = %s\nrequest.URL = %s" %
>                 (self.traverse_subpath, self.request.URL))
I like it.
 
Marius Gedminas
--
The advertisement is the most truthful part of a newspaper.
                -- Thomas Jefferson


_______________________________________________
Zope3-users mailing list
Zope3-users@...
http://mail.zope.org/mailman/listinfo/zope3-users

signature.asc (196 bytes) Download Attachment

 « Return to Thread: Specialized URL traversal.. Best way?