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 common import constants | 14 from common import constants |
| 15 | 15 |
| 16 | 16 |
| 17 JINJA_ENVIRONMENT = jinja2.Environment( | 17 JINJA_ENVIRONMENT = jinja2.Environment( |
| 18 loader=jinja2.FileSystemLoader(constants.HTML_TEMPLATE_DIR), | 18 loader=jinja2.FileSystemLoader(constants.HTML_TEMPLATE_DIR), |
| 19 extensions=['jinja2.ext.autoescape'], | 19 extensions=['jinja2.ext.autoescape'], |
| 20 autoescape=True) | 20 autoescape=True) |
| 21 | 21 |
| 22 | 22 |
| 23 def ToJson(data): | 23 def ToJson(data): |
| 24 return json.dumps(data, sort_keys=True) # Sort by key to keep order on UI. | 24 return json.dumps(data, sort_keys=True) # Sort by key to keep order on UI. |
| 25 | 25 |
| 26 | |
|
chanli
2016/06/24 18:24:20
This two lines should not be deleted.
josiahk
2016/06/27 19:33:25
Done.
lijeffrey
2016/06/27 20:38:22
I think gpylin will complain if there aren't 2 lin
josiahk
2016/06/28 22:59:23
Fixed. Thanks!
| |
| 27 JINJA_ENVIRONMENT.filters['tojson'] = ToJson | 26 JINJA_ENVIRONMENT.filters['tojson'] = ToJson |
| 28 | 27 |
| 29 | |
|
lijeffrey
2016/06/27 20:38:22
It also doesn't seem like there are any functional
| |
| 30 class Permission(object): | 28 class Permission(object): |
| 31 ADMIN = 0 | 29 ADMIN = 0 |
| 32 CORP_USER = 8 | 30 CORP_USER = 8 |
| 33 ANYONE = 16 | 31 ANYONE = 16 |
| 34 | 32 |
| 35 | 33 |
| 36 class BaseHandler(webapp2.RequestHandler): | 34 class BaseHandler(webapp2.RequestHandler): |
| 37 # By default, set permission level to ADMIN only. | 35 # By default, set permission level to ADMIN only. |
| 38 # Subclass needs to overwrite it explicitly to give wider access. | 36 # Subclass needs to overwrite it explicitly to give wider access. |
| 39 PERMISSION_LEVEL = Permission.ADMIN | 37 PERMISSION_LEVEL = Permission.ADMIN |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 return_code = 500 | 176 return_code = 500 |
| 179 cache_expiry = None | 177 cache_expiry = None |
| 180 | 178 |
| 181 self._SendResponse(template, data, return_code, cache_expiry) | 179 self._SendResponse(template, data, return_code, cache_expiry) |
| 182 | 180 |
| 183 def get(self): | 181 def get(self): |
| 184 self._Handle(self.HandleGet) | 182 self._Handle(self.HandleGet) |
| 185 | 183 |
| 186 def post(self): | 184 def post(self): |
| 187 self._Handle(self.HandlePost) | 185 self._Handle(self.HandlePost) |
| OLD | NEW |