[Zope3-Users] views based on request method (GET, POST, etc.)

Jan-Wijbrand Kolman jan-wijbrand.kolman at inghist.nl
Tue Sep 12 07:38:24 EDT 2006


Is it possible to register (browser) views based on the request method? 
E.g. to do something for GET and something else for POST requests?

Currently I do something like this (where FooView is registered as the 
default view for some interface):

class FooView(BrowserView):


   def __call__(self):
     if self.request.method = POST:
       return self.POST()
     return self.GET()

But I have the feeling this can be done more elegantly. I did notice 
something in this direction in zope/app/dav/configure.zcml, but I'm not 
sure this actually helps. It could be I overlook something very very 

Maybe someone has an idea? Any help would be highly appreciated :-)

kind regards,

Jan-Wijbrand Kolman
software developer, Institute for Netherlands History
jan-wijbrand.kolman at inghist.nl

More information about the Zope3-users mailing list