]> git.ipfire.org Git - people/ms/westferry.git/blobdiff - src/westferry/handlers/base.py
Implement some default form handler
[people/ms/westferry.git] / src / westferry / handlers / base.py
index 222767148f86098cf3a0713c8b290a9e077e54d4..774d9f23aedb6c1bf27a5c122aa7211fd0d534fc 100644 (file)
@@ -95,3 +95,18 @@ class BaseHandler(tornado.web.RequestHandler, metaclass=HandlerRegistration):
        def get(self):
                # Render the default view
                self.render("default.html")
+
+       def post(self):
+               """
+                       This is the default handler which will find the correct form
+                       and execute it.
+               """
+               form_id = self.get_argument("form")
+
+               # Find the form
+               form = self.tabs.get_form(form_id)
+               if not form:
+                       raise tornado.web.HTTPError(400, "Could not find form with ID '%s'" % form_id)
+
+               # Execute the form action
+               form.execute()