dtml-calendar: cannot update existing entry
I'm following Jon Udell's tutorial (http://zope.org/Members/judell/CalendarTagExample) verbatim and have successfully created entries in the calendar (version 1.0.15) . However when I click on an existing entry and try to change the content, I get the following error: Error Type: Bad Request Error Value: Invalid or duplicate property id. Its happening in the editCalendarProperty code: /////////////// REQUEST = context.REQUEST if ( context.hasProperty(REQUEST['prop']) ): context.manage_changeProperties({ REQUEST['prop'] : REQUEST['propval'] }) else: context.manage_addProperty(REQUEST['prop'], REQUEST['propval'], 'string') return REQUEST.RESPONSE.redirect(REQUEST['BASE4']) //////////////// I think "context.hasProperty" always returns false and so it tries to add a duplicate property. But I dont see why. Has anyone run into the same issue?
Daniel Huang wrote:
I'm following Jon Udell's tutorial (http://zope.org/Members/judell/CalendarTagExample) verbatim and have successfully created entries in the calendar (version 1.0.15) . However when I click on an existing entry and try to change the content, I get the following error:
Error Type: Bad Request Error Value: Invalid or duplicate property id.
Have you got the traceback which goes with this?
Its happening in the editCalendarProperty code: /////////////// REQUEST = context.REQUEST
if ( context.hasProperty(REQUEST['prop']) ): context.manage_changeProperties({ REQUEST['prop'] : REQUEST['propval'] }) else: context.manage_addProperty(REQUEST['prop'], REQUEST['propval'], 'string') return REQUEST.RESPONSE.redirect(REQUEST['BASE4']) ////////////////
This code could do with a lot of refactoring, when done, it becomes: r = context.REQUEST propname = r.prop propval = r.propval if context.hasProperty(propname): context.manage_changeProperties({propname:propval}) else: context.manage_addProperty(propname,propval,'string') return r.RESPONSE.redirect(r.BASE4) cheers, Chris
participants (2)
-
Chris Withers -
Daniel Huang