I'm working on a project using TurboGears and CherryPy
I've exposed a method to be posted to from another service (Mailgun) and
what I'm being sent is causing one of the filters to explode.
I give more details below but I think what I'd like is to prevent any
pre-processing of the input. Can the data that is received just be
delivered unmodified to my method?
Can I disable all filters/validators for a single method (or a single
controller?)
More details….
What's happening is that many of the keys I'm being sent have hyphens in
them such as: Content-Type, Message-Id & stripped-signature
The NestedVariables filter interprets those hyphens as indicating an array
of values of the form: name-0, name-1, name-2, etc. So it strips off the
part after the hyphen and int()'s it, causing an error.
You can see at the bottom of the stack trace how the code was trying to
turn 'signature' (from 'stripped-signature') into an int.
Stack Trace:
File
"/home/staffknex/.virtualenvs/staffknex/src/cherrypy/cherrypy/_cphttptools.py",
line 119, in _run applyFilters('before_main')
File
"/home/staffknex/.virtualenvs/staffknex/src/cherrypy/cherrypy/filters/__init__.py",
line 151, in applyFilters method()
File
"/home/staffknex/.virtualenvs/staffknex/src/turbogears/turbogears/startup.py",
line 172, in before_main request.params =
NestedVariables.to_python(request.params or {})
File
"/home/staffknex/.virtualenvs/staffknex/local/lib/python2.7/site-packages/formencode/api.py",
line 439, in to_python value = tp(value, state)
File
"/home/staffknex/.virtualenvs/staffknex/local/lib/python2.7/site-packages/formencode/variabledecode.py",
line 151, in _to_python return variable_decode(value)
File
"/home/staffknex/.virtualenvs/staffknex/local/lib/python2.7/site-packages/formencode/variabledecode.py",
line 55, in variable_decode new_keys.append(int(index)) ValueError: invalid
literal for int() with base 10: 'signature'
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.