- def do_GET_msg(self, msg):
- """Show message."""
- return self.server.jinja.get_template('msg.html').render(
- msg=msg)
+ def send_msg(self, msg, code=400):
+ """Send message in HTML formatting as HTTP response."""
+ html = self.server.jinja.get_template('msg.html').render(msg=msg)
+ self.send_html(html, code)
+
+ def do_GET(self):
+ """Handle any GET request."""
+ try:
+ parsed_url = urlparse(self.path)
+ site = path_split(parsed_url.path)[1]
+ if 'calendar' == site:
+ html = self.do_GET_calendar()
+ else:
+ raise HandledException('Test!')
+ self.send_html(html)
+ except HandledException as error:
+ self.send_msg(error)