On Tue, Feb 06, 2007 at 09:01:06PM +0100, Dennis Schulz wrote:
> Hello List,
> 
> one question about views:
> 
> I know that is is possible to register a default view for an object.
> Is there a way to decide, at runtime, which view to call?
> 
> Maybe a traversal adapter can do this,but is there an easier way?

You don't even need a redirect for that:


 from zope.app import zapi
 from zope.publisher.browser import BrowserView

 class DecisionView(BrowserView):
    def __call__(self):
       if ...:
          viewname='index.html'
       else:
          viewname='something_else.html'
       return zapi.getMultiadapter((self.context,self.request),name=viewname)()


Regards,

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

Reply via email to