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

Side by Side Diff: cms/bin/test_server.py

Issue 29569602: Noissue - Replace flake8-putty with flake8-per-file-ignores, update to flake8 3 (cms) (Closed)
Patch Set: Created Oct. 8, 2017, 6:09 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 | « cms/bin/generate_static_pages.py ('k') | cms/bin/translate.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 mime = mimetypes.guess_type(path)[0] or 'text/html' 114 mime = mimetypes.guess_type(path)[0] or 'text/html'
115 115
116 if isinstance(data, unicode): 116 if isinstance(data, unicode):
117 data = data.encode(UNICODE_ENCODING) 117 data = data.encode(UNICODE_ENCODING)
118 mime = '%s; charset=%s' % (mime, UNICODE_ENCODING) 118 mime = '%s; charset=%s' % (mime, UNICODE_ENCODING)
119 119
120 start_response('200 OK', [('Content-Type', mime)]) 120 start_response('200 OK', [('Content-Type', mime)])
121 return [data] 121 return [data]
122 122
123
123 if __name__ == '__main__': 124 if __name__ == '__main__':
124 125
125 parser = argparse.ArgumentParser(description='CMS development server created to test pages locally and on-the-fly') 126 parser = argparse.ArgumentParser(description='CMS development server created to test pages locally and on-the-fly')
126 parser.add_argument('path', nargs='?', default=os.curdir) 127 parser.add_argument('path', nargs='?', default=os.curdir)
127 parser.add_argument('-a', '--address', default='localhost', help='Address of the interface the server will listen on') 128 parser.add_argument('-a', '--address', default='localhost', help='Address of the interface the server will listen on')
128 parser.add_argument('-p', '--port', type=int, default=5000, help='TCP port t he server will listen on') 129 parser.add_argument('-p', '--port', type=int, default=5000, help='TCP port t he server will listen on')
129 args = parser.parse_args() 130 args = parser.parse_args()
130 131
131 source = create_source(args.path) 132 source = create_source(args.path)
132 address = args.address 133 address = args.address
(...skipping 29 matching lines...) Expand all
162 return app(environ, start_response) 163 return app(environ, start_response)
163 except Exception as e: 164 except Exception as e:
164 return show_error(start_response, '500 Internal Server Error ', 165 return show_error(start_response, '500 Internal Server Error ',
165 uri=environ.get('PATH_INFO'), error=e) 166 uri=environ.get('PATH_INFO'), error=e)
166 167
167 server = make_server(host, port, wrapper, ThreadedWSGIServer) 168 server = make_server(host, port, wrapper, ThreadedWSGIServer)
168 print ' * Running on http://%s:%i/' % server.server_address 169 print ' * Running on http://%s:%i/' % server.server_address
169 server.serve_forever() 170 server.serve_forever()
170 171
171 run(address, port, handler, use_reloader=True, use_debugger=True) 172 run(address, port, handler, use_reloader=True, use_debugger=True)
OLDNEW
« no previous file with comments | « cms/bin/generate_static_pages.py ('k') | cms/bin/translate.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld