Skip to content

Instantly share code, notes, and snippets.

@leeola
Created August 7, 2010 20:46
Show Gist options
  • Save leeola/513186 to your computer and use it in GitHub Desktop.
Save leeola/513186 to your computer and use it in GitHub Desktop.
class RESTfulPOSTRequestHandler(RequestHandler):
'''A RESTful way to handle POST form data.'''
def dispatch(self, method, **kwargs):
'''Upon any POST requests this class simply looks for a "method"
field, and if found, returns the appropriate response.'''
if (method == 'post' and self.request.form.has_key('method') and
self.request.form['method']):
method = str(self.request.form['method']).lower()
return super(RESTfulPOSTRequestHandler, self).dispatch(method, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment