[Zope] form problem

kuba jakub.zytka at zodiac.mimuw.edu.pl
Sun Jun 13 05:11:06 EDT 2004


hi.

i have a form, which contains a table describing some objects (in zodb). these 
objects are grouped in several folders:
ParentFolder
|
|--- Folder1
|         here are some object
|--- Folder2
|         and here too
...

 there is a radio button in every column, used to select one of object.
there are also several submit buttons - 'edit', 'view' etc.
pressing such button causes a proper method invocation on proper object:
	
lista=[]
folders = container.objectValues(['Folder']) # container == ParentFolder
for folder in folders:
	lista.append(folder.objectValues(['SomeObjectClass'])[0]) # let's say, we add 
only one object

ret = context.REQUEST['radio']
for i in lista:
	if i.objectID == ret:
		return i.action(context.REQUEST)

unfortunatelly, the code above doesnt change the context. i mean, when you 
press 'view' button, you are getting a proper view of some object, but the 
context is not changed to FolderX/objectID, but is still ParentFolder.
this causes problems - when on the view page you click on 'edit', zope tries 
to execute edit method of ParentFolder, not of FolderX/objectID.
my question:
how to change the context, and execute a proper methon on the object?

i tried that way:
instead of:
		return i.action(context.REQUEST)
i used:
		return context.REQUEST.RESPONSE.redirect(properContext+methodName)

but this solution is not acceptable, because it loses form data stored in 
REQUEST (there are another input's in the form, not only the radio button to 
select the object)

i have no bloody idea, how to do it :)

greetings,
kuba




More information about the Zope mailing list