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

Delta Between Two Patch Sets: cms/bin/test_server.py

Issue 29334114: issue 3546 - Add port and hostname options to CMS testing server (Closed)
Left Patch Set: Removed listen argument in favor of address and port, updated help text, and updated formatted stri… Created Jan. 21, 2016, 2:40 p.m.
Right Patch Set: Fixes help text wording Created Jan. 21, 2016, 4:06 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 | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2015 Eyeo GmbH 4 # Copyright (C) 2006-2015 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 if isinstance(data, unicode): 114 if isinstance(data, unicode):
115 data = data.encode(UNICODE_ENCODING) 115 data = data.encode(UNICODE_ENCODING)
116 mime = "%s; charset=%s" % (mime, UNICODE_ENCODING) 116 mime = "%s; charset=%s" % (mime, UNICODE_ENCODING)
117 117
118 start_response("200 OK", [("Content-Type", mime)]) 118 start_response("200 OK", [("Content-Type", mime)])
119 return [data] 119 return [data]
120 120
121 if __name__ == "__main__": 121 if __name__ == "__main__":
122 122
123 parser = argparse.ArgumentParser(description='CMS testing server.') 123 parser = argparse.ArgumentParser(description='CMS development server created t o test pages locally and on-the-fly')
Sebastian Noack 2016/01/21 15:12:32 Nit: As below, no full stop if it isn't a sentence
juliandoucette 2016/01/21 16:06:25 Done.
124 parser.add_argument('path', nargs='?', default=os.curdir) 124 parser.add_argument('path', nargs='?', default=os.curdir)
125 parser.add_argument('-a', '--address', default='localhost', help='Address of t he interface the server will listen on') 125 parser.add_argument('-a', '--address', default='localhost', help='Address of t he interface the server will listen on')
Sebastian Noack 2016/01/21 15:12:32 Nit: Mind making the help messages consistent? Eit
juliandoucette 2016/01/21 16:06:26 Done.
juliandoucette 2016/01/21 16:06:26 Done.
126 parser.add_argument('-p', '--port', type=int, default=5000, help='The TCP port the server will listen on') 126 parser.add_argument('-p', '--port', type=int, default=5000, help='TCP port the server will listen on')
127 args = parser.parse_args() 127 args = parser.parse_args()
128 128
129 source = FileSource(args.path) 129 source = FileSource(args.path)
130 address = args.address 130 address = args.address
131 port = args.port 131 port = args.port
132 132
133 try: 133 try:
134 from werkzeug.serving import ThreadedWSGIServer, run_simple 134 from werkzeug.serving import ThreadedWSGIServer, run_simple
135 135
136 # see https://github.com/mitsuhiko/werkzeug/pull/770 136 # see https://github.com/mitsuhiko/werkzeug/pull/770
(...skipping 23 matching lines...) Expand all
160 return app(environ, start_response) 160 return app(environ, start_response)
161 except Exception, e: 161 except Exception, e:
162 return show_error(start_response, "500 Internal Server Error", 162 return show_error(start_response, "500 Internal Server Error",
163 uri=environ.get("PATH_INFO"), error=e) 163 uri=environ.get("PATH_INFO"), error=e)
164 164
165 server = make_server(host, port, wrapper, ThreadedWSGIServer) 165 server = make_server(host, port, wrapper, ThreadedWSGIServer)
166 print " * Running on http://%s:%i/" % server.server_address 166 print " * Running on http://%s:%i/" % server.server_address
167 server.serve_forever() 167 server.serve_forever()
168 168
169 run(address, port, handler, use_reloader=True, use_debugger=True) 169 run(address, port, handler, use_reloader=True, use_debugger=True)
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld