Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/formmail/web/formmail2.py

Issue 29670611: Issue 5844 - Remove redundant parentheses in sitescripts and abpsembly (Closed) Base URL: https://hg.adblockplus.org/sitescripts/
Patch Set: Fixed one more case of redundant parentheses Created Jan. 25, 2018, 7:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sitescripts/extensions/utils.py ('k') | sitescripts/notifications/parser.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 def make_handler(name, config): 117 def make_handler(name, config):
118 try: 118 try:
119 url = config['url'].value 119 url = config['url'].value
120 except (KeyError, AttributeError): 120 except (KeyError, AttributeError):
121 raise Exception('No URL configured for form handler: ' + name) 121 raise Exception('No URL configured for form handler: ' + name)
122 try: 122 try:
123 template = config['template'].value 123 template = config['template'].value
124 get_template(template, autoescape=False) 124 get_template(template, autoescape=False)
125 except (KeyError, AttributeError): 125 except (KeyError, AttributeError):
126 raise Exception('No template configured for form handler: ' + name) 126 raise Exception('No template configured for form handler: ' + name)
127 except (jinja2.TemplateNotFound): 127 except jinja2.TemplateNotFound:
128 raise Exception('Template not found at: ' + template) 128 raise Exception('Template not found at: ' + template)
129 try: 129 try:
130 fields = config['fields'] 130 fields = config['fields']
131 for field, spec in fields.items(): 131 for field, spec in fields.items():
132 spec.value = {s.strip() for s in spec.value.split(',')} 132 spec.value = {s.strip() for s in spec.value.split(',')}
133 except KeyError: 133 except KeyError:
134 raise Exception('No fields configured for form handler: ' + name) 134 raise Exception('No fields configured for form handler: ' + name)
135 if len(fields) == 0: 135 if len(fields) == 0:
136 raise Exception('No fields configured for form handler: ' + name) 136 raise Exception('No fields configured for form handler: ' + name)
137 137
(...skipping 24 matching lines...) Expand all
162 start_response('200 OK', response_headers) 162 start_response('200 OK', response_headers)
163 return '' 163 return ''
164 164
165 return url, handler 165 return url, handler
166 166
167 167
168 conf_dict = conf_parse(get_config_items()) 168 conf_dict = conf_parse(get_config_items())
169 for name, config in conf_dict.items(): 169 for name, config in conf_dict.items():
170 url, handler = make_handler(name, config) 170 url, handler = make_handler(name, config)
171 registerUrlHandler(url, handler) 171 registerUrlHandler(url, handler)
OLDNEW
« no previous file with comments | « sitescripts/extensions/utils.py ('k') | sitescripts/notifications/parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld