-
Notifications
You must be signed in to change notification settings - Fork 1
/
view.py
46 lines (34 loc) · 1020 Bytes
/
view.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
45
46
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
from google.appengine.ext.webapp import template
from django.utils import simplejson as json
class View():
def __init__(self, request):
pass
def render(self, out):
pass
class Signup(View):
def __init__(self, request, params):
self.params = params
# xhr
if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
layout = 'ajax.html'
else:
layout = 'layout.html'
self.params['layout'] = layout
def render(self, out):
path = os.path.join('templates/signup.html')
out.write(template.render(path, self.params))
class Login(View):
def __init__(self, request, params):
self.params = params
# xhr
if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
layout = 'ajax.html'
else:
layout = 'layout.html'
self.params['layout'] = layout
def render(self, out):
path = os.path.join('templates/login.html')
out.write(template.render(path, self.params))