Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: app_config.py

Issue 23602002: Fix handling of unset AppConfig model properties. (Closed) Base URL: https://git.chromium.org/git/chromium/tools/reviewbot.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698