On Thursday, September 25, 2003, at 10:31 PM, Edmund Lian wrote:
> I've been seeing intermittent _formID_ KeyErrors with FunFormKit of
> the form:
>
> Traceback (most recent call last):
> File "WebKit/Application.py", line 415, in dispatchRequest
> File "WebKit/Application.py", line 567, in handleGoodURL
> File "WebKit/Application.py", line 776, in respond
> File "WebKit/Transaction.py", line 105, in respond
> File "WebKit/HTTPServlet.py", line 38, in respond
> File "/opt/Mefa/SiteLib/Page.py", line 113, in respondToPost
> self._respond(transaction)
> File "/opt/Mefa/SiteLib/Page.py", line 134, in _respond
> self.mainResponse()
> File "/opt/Mefa/Contexts/Home/Login.py", line 50, in mainResponse
> formProcessed, data = self.processForm()
> File "/opt/Webware/FunFormKit/Form.py", line 127, in processForm
> currentForm = self._formDefinitions[req.field('_formID_')]
> KeyError: form1
>
>
> I've been trying to figure out when these are triggered, and how best
> to deal with them.
>
> I know for example, that if I have a form on display, then restart the
> appserver, then try to submit the form, the error will pop up. It also
> pops up if the browser's back and forward navigation buttons are used
> prior to form submission. So, the issue seems to be related to the
> browser caching pages, as well as the fact that the formID was
> autogenerated so that between restarts, the same form might have
> different formIDs.
The problem is you are using mutable forms, and the forms are stored in
a module global and keyed to these dynamic names (like "form1"). When
you restart the AppServer there may be people with reference to forms
that no longer exist.
Ideally these should be stored in some other persistent form. It would
be nice if the session mechanism could be reused in some global
fashion, and this stuff could be stored in there. (There's several
places where global persistent data would be nice, e.g., randomly
generated keys used to sign hidden fields)
Ian
|