[Zope3-Users] Specialized URL traversal.. Best way?
Marius Gedminas
mgedmin at b4net.lt
Tue Jan 10 14:38:41 EST 2006
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20060110/9abb6034/attachment.bin
More information about the Zope3-users
mailing list