]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Make parse_command_line initialize logging even when there are non-option
authorBen Darnell <bdarnell@beaker.local>
Fri, 22 Jan 2010 21:09:51 +0000 (13:09 -0800)
committerBen Darnell <bdarnell@beaker.local>
Fri, 22 Jan 2010 21:09:51 +0000 (13:09 -0800)
arguments.

tornado/options.py

index 1f676ff01479373122341ae1b5ba66f15663a8b5..c7046a328c457972fe862e0f8e899e50b278e562 100644 (file)
@@ -100,10 +100,12 @@ def parse_command_line(args=None):
     We return all command line arguments that are not options as a list.
     """
     if args is None: args = sys.argv
+    remaining = []
     for i in xrange(1, len(args)):
         # All things after the last option are command line arguments
         if not args[i].startswith("-"):
-            return args[i:]
+            remaining = args[i:]
+            break
         if args[i] == "--":
             continue
         arg = args[i].lstrip("-")
@@ -127,7 +129,7 @@ def parse_command_line(args=None):
     logging.getLogger().setLevel(getattr(logging, options.logging.upper()))
     enable_pretty_logging()
 
-    return []
+    return remaining
 
 
 def parse_config_file(path, overwrite=True):
@@ -307,7 +309,7 @@ def enable_pretty_logging():
         return
     channel = logging.StreamHandler()
     channel.setFormatter(_ColorLogFormatter())
-    logging.getLogger().addHandler(channel)        
+    logging.getLogger().addHandler(channel)
 
 
 class _ColorLogFormatter(logging.Formatter):