On 04/09/16 10:12, Stephen Finucane wrote:
+class Command(base.BaseCommand):
+    help = 'Parse an mbox file and store any patch/comment found.'
+
+    if django.VERSION < (1, 8):
+        args = '<infile>'
+        option_list = base.BaseCommand.option_list + (
+            make_option(
+                '--list-id',
+                help='mailing list ID. If not supplied, this will be '
+                'extracted from the mail headers.'),
+        )
+    else:
+        def add_arguments(self, parser):
+            parser.add_argument(
+                'infile',
+                nargs='?',
+                type=argparse.FileType('r'),
+                default=sys.stdin,
+                help='input mbox file (a filename or stdin)')
+            parser.add_argument(
+                '--list-id',
+                action='store_true',
+                help='mailing list ID. If not supplied, this will be '
+                'extracted from the mail headers.')
+
+    def handle(self, *args, **options):
+        path = (args[0] if args else
+                options['infile'] if 'infile' in options else None)
+        stdin = options.get('stdin', sys.stdin)
+
+        # Attempt to parse the path if provided, and fallback to stdin if not
+        if path and not isinstance(path, file):

This is broken on Python 3 as the 'file' type no longer exists.

--
Andrew Donnellan              OzLabs, ADL Canberra
[email protected]  IBM Australia Limited

_______________________________________________
Patchwork mailing list
[email protected]
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to