-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (27 loc) · 1.05 KB
/
main.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
import sys
import os
import logging
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import login_required
from nomic.browser import BrowserHandler
from nomic.proposal import CreateProposalHandler, ViewProposalHandler, ListProposalHandler
from nomic.chrome import PygmentsHandler
from nomic.util import _user
class MainHandler(webapp.RequestHandler):
def get(self):
self.response.out.write(self.env.get_template('index.html').render(locals()))
class AboutHandler(webapp.RequestHandler):
def get(self):
self.response.out.write(self.env.get_template('about.html').render(locals()))
routes = [
('/', MainHandler),
('/browser(.*)', BrowserHandler),
('/proposal/create', CreateProposalHandler),
('/proposal/(\d+)', ViewProposalHandler),
('/proposal(?:/)?', ListProposalHandler),
('/about', AboutHandler),
('/pygments.css', PygmentsHandler),
]
def pre_request(handler):
handler.request._user, handler.request._user_admin, handler.request._user_url = _user(handler)
return handler