forked from sydney-linux-user-group/slug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
44 lines (33 loc) · 1.13 KB
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python
#
# -*- coding: utf-8 -*-
# vim: set ts=4 sw=4 et sts=4 ai:
"""Simple pages."""
# Python imports
import os
# AppEngine Imports
from google.appengine.ext import webapp
# Our App imports
import events
from utils.render import render as r
class Index(events.Events):
"""Handler for index page."""
published_only = True
template = "templates/index.html"
class Refresh(webapp.RequestHandler):
"""Handler for a page which causes the parent to refresh.
Redirect to this page when an iFrame needs the containing page to reload,
such as after a success login attempt.
"""
def get(self):
self.response.headers['Content-Type'] = 'text/html'
self.response.out.write(r('templates/refresh.html', locals()))
class StaticTemplate(webapp.RequestHandler):
"""Handler which shows a map of how to get to slug."""
def get(self, filename):
template = 'templates/%s.html' % filename
if os.path.exists(template):
self.response.headers['Content-Type'] = 'text/html'
self.response.out.write(r(template, locals()))
else:
self.redirect('/')