diff options
Diffstat (limited to 'py-bin/main.py')
-rw-r--r-- | py-bin/main.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/py-bin/main.py b/py-bin/main.py new file mode 100644 index 0000000..39294e0 --- /dev/null +++ b/py-bin/main.py @@ -0,0 +1,31 @@ +#main url mapper + +from utils import BasicHandler, process_request, set_logging_defaults +from jabberman import JabberManager +from login import LoginMixIn +from mail_auth import MailAuthMixIn +from setup import SetupMixIn + +set_logging_defaults() + +class MainHandler(BasicHandler, MailAuthMixIn, LoginMixIn, SetupMixIn): + def do_process(self, req): + command = req.params.get("cmd", "") + + if command == "": + self.login_form(req) + else: + if hasattr(self, command): + method = getattr(self, command) + if hasattr(method, 'web_callable') and method.web_callable: + self.jman = JabberManager(self.session) + method(req) + else: + self.invalid_page(req) + else: + self.invalid_page(req) + + def invalid_page(self, req): + self.error_page(req, "Ungueltiger Request.") + +process_request(MainHandler)
\ No newline at end of file |