Re: [FE-discuss] KeyError on validation failure after upgrad…

Top Page
Author: Ian Bicking
Date:  
To: John Dickson
CC: formencode-discuss
Subject: Re: [FE-discuss] KeyError on validation failure after upgrading formencode
Probably it would be better to ask on the Pylons list, there's a good
chance someone else has seen this problem and will recognize it.

On Thu, Mar 12, 2009 at 5:57 PM, John Dickson <captsens@???> wrote:
> Hi Ian
>
> Thanks for the AuthKit suggestion.
>
> I repeated the test (submitting the form with all fields empty, which fails
> validation) with the AuthKit decorator commented out on both the form
> display and submission methods, and got the same end result (KeyError on
> trying to use a parameter from request.params in the form display method,
> after validation failure).  The stack trace looks the same (but of course
> shorter), and at a quick glance the WSGI variables (on the Pylons error
> debug page) look about the same, particularly the webob._parsed_post_vars
> variable.
>
> Any suggestions about what I should try next?  Would more/different
> information about my environment or code help?  Also, am I asking the
> question on the correct list?
>
> Anyway, thanks again for your assistance.
> John
>
> 2009/3/13 Ian Bicking <ianb@???>
>>
>> I'm wonder if perhaps this is an AuthKit/WebOb conflict.  It might be
>> that AuthKit is reading in the parameters of POST requests in such a
>> way that WebOb can't see them.  You could test by creating a POST form
>> with a simple controller, and seeing if the POST variables get
>> swallowed.  It isn't necessarily AuthKit that is swallowing them, but
>> it seems like a good chance (disabling AuthKit and testing would make
>> it clear).
>>
>> On Tue, Mar 10, 2009 at 6:32 AM, John Dickson <captsens@???> wrote:
>> > Hi folks
>> >
>> > I've recently run into lots of problems with validation in an app of
>> > mine,
>> > after upgrading to formencode 1.2.x.  This is a Pylons-based app (I've
>> > also
>> > just upgraded Pylons from 0.9.6 to 0.9.7), which has been working fine
>> > for a
>> > number of people until these upgrades.  I've been beating my head
>> > against a
>> > brick wall trying to diagnose this for a couple of days now, and still
>> > haven't got anywhere, so I'd be *really* grateful for any pointers you
>> > could
>> > give.
>> >
>> > I have to say, though, that I'm pretty much a newbie on formencode.  I'm
>> > also also only guessing that this is a formencode issue, but it may well
>> > be
>> > Pylons.
>> >
>> > My controllers use the Pylons @validate decorator.  Everything is fine
>> > if
>> > there are no errors detected by the decorator (using a subclass of
>> > Schema),
>> > but if any validation failure occurs I get a KeyError when trying to run
>> > the
>> > controller method to redisplay the form.  Examining the request, I see
>> > that
>> > params, GET and POST are all empty (UnicodeMultiDict objects), while the
>> > WSGI webob._parsed_post_vars variable seems to have all my POST fields
>> > in it
>> > (exactly what I'd have expected to see in params).
>> >
>> > I'm including a stack trace below, in case that's of any assistance.
>> > Thanks
>> > in advance for your help.
>> >
>> > Cheers .................................... John Dickson
>> >
>> > Traceback (most recent call last):
>> >   File "/home/johnd/python/jcr-0.6.7/jcr/lib/base.py", line 98, in
>> > __call__
>> >     return WSGIController.__call__(self, environ, start_response)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/controllers/core.py",
>> > line 221, in __call__
>> >     response = self._dispatch_call()
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/controllers/core.py",
>> > line 172, in _dispatch_call
>> >     response = self._inspect_call(func)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/controllers/core.py",
>> > line 107, in _inspect_call
>> >     result = self._perform_call(func, args)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/controllers/core.py",
>> > line 60, in _perform_call
>> >     return func(**args)
>> >   File "<string>", line 2, in upload
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/AuthKit-0.4.3-py2.5.egg/authkit/authorize/pylons_adaptors.py",
>> > line 36, in validate
>> >     return permission.check(app, request.environ, self.start_response)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/AuthKit-0.4.3-py2.5.egg/authkit/permissions.py",
>> > line 177, in check
>> >     return app(environ, start_response)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/AuthKit-0.4.3-py2.5.egg/authkit/authorize/pylons_adaptors.py",
>> > line 35, in app
>> >     return func(self, *args, **kwargs)
>> >   File "<string>", line 2, in upload
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/decorators/__init__.py",
>> > line 161, in wrapper
>> >     response = self._dispatch_call()
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/controllers/core.py",
>> > line 172, in _dispatch_call
>> >     response = self._inspect_call(func)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/controllers/core.py",
>> > line 107, in _inspect_call
>> >     result = self._perform_call(func, args)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/controllers/core.py",
>> > line 60, in _perform_call
>> >     return func(**args)
>> >   File "<string>", line 2, in index
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/AuthKit-0.4.3-py2.5.egg/authkit/authorize/pylons_adaptors.py",
>> > line 36, in validate
>> >     return permission.check(app, request.environ, self.start_response)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/AuthKit-0.4.3-py2.5.egg/authkit/permissions.py",
>> > line 177, in check
>> >     return app(environ, start_response)
>> >   File
>> >
>> > "/usr/lib/python2.5/site-packages/AuthKit-0.4.3-py2.5.egg/authkit/authorize/pylons_adaptors.py",
>> > line 35, in app
>> >     return func(self, *args, **kwargs)
>> >   File
>> >
>> > "/home/johnd/python/jcr-0.6.7/jcr/controllers/projectadmin/selectfileset.py",
>> > line 52, in index
>> >     c.projectId = int(request.params['projectId'])
>> >   File "build/bdist.linux-i686/egg/webob/multidict.py", line 314, in
>> > __getitem__
>> >     return
>> > self._decode_value(self.multi.__getitem__(self._encode_key(key)))
>> >   File "build/bdist.linux-i686/egg/webob/multidict.py", line 440, in
>> > __getitem__
>> >     raise KeyError(key)
>> > KeyError: 'projectId'
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > FormEncode-discuss mailing list
>> > FormEncode-discuss@???
>> > https://lists.sourceforge.net/lists/listinfo/formencode-discuss
>> >
>> >
>>
>>
>>
>> --
>> Ian Bicking  |  http://blog.ianbicking.org
>
>
>
> --
>    /Angle-parked in a parallel universe.../
>




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

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss@???
https://lists.sourceforge.net/lists/listinfo/formencode-discuss