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

Unified Diff: cms/bin/test_server.py

Issue 29334114: issue 3546 - Add port and hostname options to CMS testing server (Closed)
Patch Set: Changed basepath to positional argument and added defaults to hostname and port Created Jan. 20, 2016, 5:17 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/bin/test_server.py
===================================================================
--- a/cms/bin/test_server.py
+++ b/cms/bin/test_server.py
@@ -119,20 +119,14 @@
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='CMS testing server.')
- parser.add_argument('-b', '--basepath', type=str, help='Base directory (EG: /path/to/web.eyeo.com)')
- parser.add_argument('-n', '--hostname', type=str, help='Server hostname (EG: localhost, eyeo.com, 0.0.0.0)')
- parser.add_argument('-p', '--port', type=str, help='Port number (EG: 8080, 5000)')
+ parser.add_argument('basepath', nargs='?', default=os.curdir)
Sebastian Noack 2016/01/20 17:46:25 Nit: I would simply call it "path".
juliandoucette 2016/01/21 13:46:24 Done.
+ parser.add_argument('-n', '--hostname', default='localhost', type=str, help='Server hostname (EG: localhost, example.com, 0.0.0.0)')
Sebastian Noack 2016/01/20 17:46:25 Nit: "Address of the interface the server will lis
Sebastian Noack 2016/01/20 17:46:25 type=str is the default. How about omitting it, if
Sebastian Noack 2016/01/20 18:00:55 --address would be a better name for the option, a
juliandoucette 2016/01/21 13:46:24 Done.
juliandoucette 2016/01/21 13:46:24 Acknowledged.
juliandoucette 2016/01/21 13:46:24 Done.
+ parser.add_argument('-p', '--port', default='5000', type=str, help='Port number (EG: 8080, 5000)')
Sebastian Noack 2016/01/20 17:46:25 How about type=int? Then you don't need to convert
juliandoucette 2016/01/21 13:46:23 Done.
args = parser.parse_args()
- # for backwards compatibility
- if len(sys.argv) > 1 and os.path.isdir(sys.argv[1]):
- source = FileSource(sys.argv[1])
- hostname = 'localhost'
- port = 5000
- else:
- source = FileSource(args.basepath or os.curdir)
- hostname = args.hostname or 'localhost'
- port = int(args.port or '5000')
+ source = FileSource(args.basepath)
+ hostname = args.hostname
+ port = int(args.port)
try:
from werkzeug.serving import ThreadedWSGIServer, run_simple
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld