Stephan Richter wrote:
On Saturday 02 April 2005 04:38, jÃrgen Kartnaller wrote:

Why in the world would you want to do that? This seems just awful. What
is your use case?

In my case I want to have the possibility to jump back to my base view (which is the default view of my site) from wherever I am within my site.

But, if there is an easier way to do this, please let me know.


Then write a wrapper view for all interfaces that internally looks up the next site and looks up the default view:

class SiteDefaultView(object):

  def __call__(self):
        site = getNextSiteSomehow()
        defaultViewName = getDefaultViewName(site, self.request, site)
        view = zapi.getMultiAdapter((site, request), Interface, 
name=defaultViewName)
        return view()

Thanks Stephan,
I learned a lot from this code.

But I think my solution is much easier to handle.
I don't need to define a view for every interface.
I just have to implement my traverser which is a one liner.
ZCML is also reusable, it could be easily integrated into zope as a standard traverser ;)


JÃrgen

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

Reply via email to