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

Delta Between Two Patch Sets: sitescripts/testpages/web/sitekey_frame.py

Issue 29756624: Noissue - Adapt best practices for trailing commas (sitescripts) (Closed)
Left Patch Set: Created April 19, 2018, 12:40 p.m.
Right Patch Set: Re-run script on Python 2, added flake8-commas extension Created April 19, 2018, 2:35 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/templateFilters.py ('k') | tox.ini » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 13 matching lines...) Expand all
24 @url_handler('/sitekey-frame') 24 @url_handler('/sitekey-frame')
25 def sitekey_frame(environ, start_response): 25 def sitekey_frame(environ, start_response):
26 template_path, template_file = os.path.split( 26 template_path, template_file = os.path.split(
27 get_config().get('testpages', 'sitekeyFrameTemplate'), 27 get_config().get('testpages', 'sitekeyFrameTemplate'),
28 ) 28 )
29 template = get_template(template_file, template_path=template_path) 29 template = get_template(template_file, template_path=template_path)
30 30
31 key = M2Crypto.EVP.load_key(get_config().get('testpages', 'sitekeyPath')) 31 key = M2Crypto.EVP.load_key(get_config().get('testpages', 'sitekeyPath'))
32 key.sign_init() 32 key.sign_init()
33 key.sign_update('\x00'.join(( 33 key.sign_update('\x00'.join((
34 request_path(environ), environ['HTTP_HOST'], environ['HTTP_USER_AGENT'], 34 request_path(environ),
35 environ['HTTP_HOST'],
36 environ['HTTP_USER_AGENT'],
35 ))) 37 )))
36 38
37 public_key = base64.b64encode(key.as_der()) 39 public_key = base64.b64encode(key.as_der())
38 signature = base64.b64encode(key.final()) 40 signature = base64.b64encode(key.final())
39 41
40 start_response('200 OK', 42 start_response('200 OK',
41 [('Content-Type', 'text/html; charset=utf-8'), 43 [('Content-Type', 'text/html; charset=utf-8'),
42 ('X-Adblock-Key', '%s_%s' % (public_key, signature))]) 44 ('X-Adblock-Key', '%s_%s' % (public_key, signature))])
43 return [template.render({'public_key': public_key, 45 return [template.render({'public_key': public_key,
44 'signature': signature}).encode('utf-8')] 46 'signature': signature}).encode('utf-8')]
LEFTRIGHT

Powered by Google App Engine
This is Rietveld