args for OptionsParser defaults to sys.argv
authorKonstantin Stepanov <kstep@p-nut.info>
Sun, 28 Nov 2010 13:24:26 +0000 (15:24 +0200)
committerKonstantin Stepanov <kstep@p-nut.info>
Sun, 28 Nov 2010 13:26:12 +0000 (15:26 +0200)
dbuscron/parser.py

index b004fb7..0d26c85 100644 (file)
@@ -78,8 +78,13 @@ class CrontabParser(object):
                     yield ruled, command
 
 class OptionsParser(dict):
-    def __init__(self, args, opts):
+    def __init__(self, opts, args=None):
         super(OptionsParser, self).__init__()
+
+        if args is None:
+            import sys
+            args = sys.argv[1:]
+
         from getopt import getopt
         go, _ = getopt(args, opts)