[Zope] Trying to implement a simple mvc or how do you pass the REQUEST o
bject when doing a redirect?
Pierce, Scott
Scott.Pierce@Sonopress.com
Thu, 25 Jul 2002 09:11:46 -0400
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
REQUEST object and I use that like this:
def parseSubPath(self):
"""
Parses the subpath and gives us access
to the variables contained therein
"""
set = self.REQUEST.set
subpath = self.REQUEST.traverse_subpath
idx = len(subpath)-1
jdx = 0
while jdx < idx:
set(subpath[jdx],subpath[jdx+1])
jdx += 1
this allows me to put variables in the URL (it seems like there is another
way of doing this but.... i don't know what it is). This code is called in
standard_html_header and breaks with the controller code above.
So, I either need to fix the parseSubPath code (there is a LOT of code that
uses this so major refactoring to change) or I could change the controller
method to do a redirect but then I need to be able to pass the REQUEST
object from the controller method to the redirected object.
The question is, how do you pass the REQUEST object when doing a redirect?
Scott Pierce
Sonopress US - Digital Services
828.658.6157