[Zope] Trying to implement a simple mvc or how do you pass the REQUEST o bject when doing a redirect?

Dieter Maurer dieter@handshake.de
Thu, 25 Jul 2002 21:13:17 +0200


Pierce, Scott writes:
 > I have a product that I am attempting to do something like this:
 > 
 >     def controller(self):
 >         """ 
 >         This will implement a MVC type paradigm for user administration.
 >         """
 >         req = self.REQUEST
 >         f = req.form
 > 
 >         controldict = {'adduser': self.CreateUser,
 >                         'viewuser': self.ViewUser,
 >                         'edituser': self.EditUser,
 >                         'None': MessageDialog(title='Error: Action not
 > Recognized',
 >                                             message='The action you took is
 > not recognized',
 >                                             action='Admin')}
 > 
 >         controldict[f.get('controlaction','None')]()  
 > 
 > It would work except calling the dtml method like this causes there to be no
 > traverse_subpath in the 
You should *NEVER* call DTML objects without its two positional arguments.
Read "Calling DTML objects" in 

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>




Dieter