Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import collections | 5 import collections |
| 6 import json | 6 import json |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 | 9 |
| 10 from google.appengine.api import users | 10 from google.appengine.api import users |
| 11 import jinja2 | 11 import jinja2 |
| 12 import webapp2 | 12 import webapp2 |
| 13 | 13 |
| 14 from handlers import result_status | |
|
stgao
2016/03/28 23:29:26
It seems we could revert the change in this CL.
chanli
2016/03/29 01:35:56
Done.
| |
| 15 | |
| 14 | 16 |
| 15 JINJA_ENVIRONMENT = jinja2.Environment( | 17 JINJA_ENVIRONMENT = jinja2.Environment( |
| 16 loader=jinja2.FileSystemLoader( | 18 loader=jinja2.FileSystemLoader( |
| 17 os.path.join(os.path.dirname(__file__), 'templates')), | 19 os.path.join(os.path.dirname(__file__), 'templates')), |
| 18 extensions=['jinja2.ext.autoescape'], | 20 extensions=['jinja2.ext.autoescape'], |
| 19 autoescape=True) | 21 autoescape=True) |
| 20 | 22 |
| 21 | 23 |
| 22 def ToJson(data): | 24 def ToJson(data): |
| 23 return json.dumps(data) | 25 return json.dumps(data) |
| 24 | 26 |
| 25 | |
| 26 JINJA_ENVIRONMENT.filters['tojson'] = ToJson | 27 JINJA_ENVIRONMENT.filters['tojson'] = ToJson |
| 27 | 28 |
| 28 | 29 |
| 29 class Permission(object): | 30 class Permission(object): |
| 30 ADMIN = 0 | 31 ADMIN = 0 |
| 31 CORP_USER = 8 | 32 CORP_USER = 8 |
| 32 ANYONE = 16 | 33 ANYONE = 16 |
| 33 | 34 |
| 34 | 35 |
| 35 class BaseHandler(webapp2.RequestHandler): | 36 class BaseHandler(webapp2.RequestHandler): |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 return_code = 500 | 178 return_code = 500 |
| 178 cache_expiry = None | 179 cache_expiry = None |
| 179 | 180 |
| 180 self._SendResponse(template, data, return_code, cache_expiry) | 181 self._SendResponse(template, data, return_code, cache_expiry) |
| 181 | 182 |
| 182 def get(self): | 183 def get(self): |
| 183 self._Handle(self.HandleGet) | 184 self._Handle(self.HandleGet) |
| 184 | 185 |
| 185 def post(self): | 186 def post(self): |
| 186 self._Handle(self.HandlePost) | 187 self._Handle(self.HandlePost) |
| OLD | NEW |