Can't store Invalid object in session

Ian Bicking <[email protected]> Wed, 3 Jun 2009 17:02:51 -0500
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Sorry for the slow reply...

On Sun, May 31, 2009 at 7:50 PM, Chris Vickerson <chris-49n0//[email protected]>wrote:

>
> 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
>

A workaround: save error.unpack_errors(), which won't contain any exception
objects.



> I've found a conversation that led me to this open bug:
> http://bugs.python.org/issue1692335 I think this is the problem that is
> not allowing me to store this
> object in session.
>

Yes, that's what is causing the problem.  It seems best just to allow this
to be fixed upstream in Python, especially since unpack_errors has a very
reasonable return value anyway.



-- 
Ian Bicking  |  http://blog.ianbicking.org



-- 
Ian Bicking  |  http://blog.ianbicking.org

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get

_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss