OLD | NEW |
---|---|
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Request handler for the /admin/app_config page. | 5 """Request handler for the /admin/app_config page. |
6 | 6 |
7 Allows admins to set configuration parameter via the appengine admin console. | 7 Allows admins to set configuration parameter via the appengine admin console. |
8 """ | 8 """ |
9 | 9 |
10 import cgi | 10 import cgi |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 self.RenderForm() | 54 self.RenderForm() |
55 | 55 |
56 def RenderForm(self): | 56 def RenderForm(self): |
57 """Renders the app config form to the client.""" | 57 """Renders the app config form to the client.""" |
58 app_config = model.app_config.get() | 58 app_config = model.app_config.get() |
59 self.response.write('<html><body><form action="%s" method="post"><table>' % | 59 self.response.write('<html><body><form action="%s" method="post"><table>' % |
60 self.request.path) | 60 self.request.path) |
61 for field in FIELDS: | 61 for field in FIELDS: |
62 self.response.write( | 62 self.response.write( |
63 '<tr><td>%s</td><td><textarea name="%s">%s</textarea></td></tr>' % | 63 '<tr><td>%s</td><td><textarea name="%s">%s</textarea></td></tr>' % |
64 (field, field, cgi.escape(getattr(app_config, field, '')))) | 64 (field, field, cgi.escape(getattr(app_config, field) or ''))) |
agable
2013/08/27 14:35:15
can simply use getattr(app_config, field, '') inst
Mattias Nissler (ping if slow)
2013/08/27 14:40:09
That's what I had before. It doesn't work in this
| |
65 self.response.write('<tr><td><input type="submit" value="Set"></td></tr>') | 65 self.response.write('<tr><td><input type="submit" value="Set"></td></tr>') |
66 self.response.write('</table><form></body></body>') | 66 self.response.write('</table><form></body></body>') |
67 | 67 |
68 | 68 |
69 app = webapp2.WSGIApplication([('/admin/app_config', AppConfigHandler)]) | 69 app = webapp2.WSGIApplication([('/admin/app_config', AppConfigHandler)]) |
OLD | NEW |