[Zope3-Users] Re: Traverse to nearest site in menu action

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Apr 3 20:20:19 EDT 2005


On Sunday 03 April 2005 17:02, Florian Lindner wrote:
> > You probably set your base path incorrectly. Anyways, I still think this
> > is a horrible way to do it; I would rather build a view that forwards you
> > to the site.
>
> Hello,
> I've implemented a view like that:
>
> class toSite(object):
>     def __call__(self):
>         from zope.app.zapi import absoluteURL
>         URL = absoluteURL(getSite(), self.request)
>         return self.request.response.redirect(URL)
>
> Which for me works perfectly. Any drawbacks of this solution?

No, this is perfect. Its even cleverer than my suggest algorithm.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list