[Zope-CMF] Problem after invokeFactory
Rob Boyd
boydrobh at yahoo.com
Tue Feb 1 15:14:38 EST 2005
Hello everyone,
I'm getting unexpected behavior when submitting a form that adds a
content object to another container object. The scenario:
'CustomFolder' has an action 'Add Foo' with a form add_foo_form. I fill
out the form with values that will become attributes of new foo
(similar to CMFCollector having a master form for adding
CollectorIssues). When the form is submitted, a new 'Foo' is added, and
then the view is *supposed to* redirect to the View action of
CustomFolder (not Foo). This used to work on my dev site, and still
works on my test site. But now on dev, as soon as invokeFactory of Foo
is called, I'm redirected to the initial view of Foo types, which is a
screen to edit the new Foo object. Some code snippets:
# From foo_add_control.py
try:
context.invokeFactory('Foo', id, context.REQUEST.RESPONSE)
# It no longer gets to here, but it used to!
# Tested with: raise "Just added a new foo" but no exception raised
obj = context.get(id, None)
obj.edit(title=title, description=description)
except:
return context.setStatus(False, 'Could not add Foo %s' % id )
return context.setStatus(True, 'Changes successful.')
# Foo's factory method
def addGroup(self, id, title = '', REQUEST = {}):
"""
Factory method for a Foo object
"""
foo = Foo(id, title)
self._setObject(id, foo)
# make sure that creator has special role to begin with
foo = getattr(self, id)
membership = getToolByName(self, 'portal_membership')
member = membership.getAuthenticatedMember()
foo.manage_setLocalRoles(member.getUserName(), ['FooRole',])
if REQUEST.has_key('RESPONSE'):
return REQUEST.RESPONSE.redirect('manage_main')
# End of code
I cannot find ANY diffs between my dev and test code, looking at the
form template, form script, form control script, and the Foo class
(especially the factory method). I can't find any TTW changes that
could affect this (such as in portal types). I'm using CMF 1.5.
I'm at a loss. Flummoxed. Stymied. Any tips for where to look next?
Thank you,
Rob
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
More information about the Zope-CMF
mailing list