cookie Crumbler problem
I have a daily schedule on my site that uses properties to store the events. A form passes the variables to a python script which changes the properties of the page. Things work perfectly when I'm already logged in as a manager. I can set and reset property items. But when I enter my site as anonymous and try to do a manager function I get redirected to the cookie crumbler's authentication page. (good so far) When I get past authentication I get to the python script with an error that says: Error Type: KeyError Error Value: 'prop' But with a url like: http://mysite.com/dailySchedule/editCalendarProperty?prop=2004%2F03%2F25&pro... When I don't try to change the properties from the python script I can see and print the variables (prop and propval) perfectly. But it is as if the manageAddProperties('prop', prop) wrecks access to the variables. I've tried looping through the has_items() but the managing lines in the script still can't see the variables. I've tried passing all the variables in the header to the login page as hidden variables, but that fails too. Please help. Joshua
Joshua Newman wrote:
Error Type: KeyError Error Value: 'prop'
What's the traceback to go with the above?
When I don't try to change the properties from the python script I can see and print the variables (prop and propval) perfectly. But it is as if the manageAddProperties('prop', prop) wrecks access to the variables.
I think you're missing out some steps in your explanation here. At least, it doesn't seem very clear what order things are happening in and what the outcome is at each stage...
I've tried looping through the has_items() but the managing lines in the script still can't see the variables.
I've tried passing all the variables in the header to the login page as hidden variables, but that fails too.
Take a step back. What are you trying to do? What tracebacks are you getting? What are the revelent lines of code that you've written? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
"Chris" == Chris Withers <lists@simplistix.co.uk> writes:
>> When I don't try to change the properties from the python >> script I can see and print the variables (prop and propval) >> perfectly. But it is as if the manageAddProperties('prop', >> prop) wrecks access to the variables. Whoops that was pretty unclear. Chris> Take a step back. What are you trying to do? What Chris> tracebacks are you getting? What are the revelent lines of Chris> code that you've written? I'm trying to process a form to change properties. If a user is authenticated when at the form, all is smooth. When a user is anonymous and submits the cookie authentication in the middle of the transaction seems cause an error. >> Error Type: KeyError Error Value: 'prop' Chris> What's the traceback to go with the above? Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module Shared.DC.Scripts.Bindings, line 306, in __call__ Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec Module Products.PythonScripts.PythonScript, line 318, in _exec Module None, line 3, in editCalendarProperty - <PythonScript at /masonicmed/dailySchedule/editCalendarProperty> - Line 3 Module AccessControl.ZopeGuards, line 67, in guarded_getitem Module ZPublisher.HTTPRequest, line 1214, in __getitem__ KeyError: 'propval' Code for form: (in html without the end brackets) input name="prop" type="hidden" value="<dtml-var prop>" textarea name="propval" rows="15" cols="65" wrap="hard" /textarea and the python code : REQUEST = context.REQUEST propval = (REQUEST['propval']) prop = (REQUEST['prop']) if ( context.index_html.hasProperty(REQUEST['prop']) ): context.index_html.manage_changeProperties({ REQUEST['prop'] : propval }) else: context.index_html.manage_addProperty(REQUEST['prop'], propval, 'text') return REQUEST.RESPONSE.redirect(REQUEST['URL1']) What's interesting is that it works when a user is already authenticated and makes it to the edit form. It fails only when the form is arrived at by an anonymous user and has to authenticate in the middle of the form submission when the python script requires privileges in order to change properties. I'm using Cookie crumbler (newest version). And I've tried making the individual pages secured but the same problem occurs. When the form is secured it disables the passed variables needed to use the form. And when the python script is secured the same problem happens as above. Thanks for the willingness to take a look at this. j
participants (2)
-
Chris Withers -
Joshua Newman