Hi - I'm trying to set some session variables inside an exception
handler of FormEncode validation testing. It seems that if I try to
save the result of "error.error_dict" into a session variable all my
session variables are deleted. I experimented with a bunch of
different ways to narrow this down. All I have to do is not try to
save error.error_dict and everything works as expected. My code looks
like this:
import formencode
...
class FilesController(BaseController):
def view_by_id(self):
schema = ListForm()
try:
form_result = schema.to_python(dict
(request.params))
except formencode.Invalid, error:
session['defaults'] = error.value
session['errors'] = error.error_dict or {}
#comment out this line and it saves ok
session.save()
redirect_to(controller='files', action='list')
class ListForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
file_select = formencode.validators.Int(not_empty=True)
I think I've posted enough of the code - it's pretty basic I think. I
searched google/google groups but didn't find any similar problems so
I must be doing something wrong.
Any help is appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---