[Python-modules-commits] [django-celery] 01/04: Fix management command handling for django >= 1.10

Brian May bam at moszumanska.debian.org
Wed Feb 22 21:20:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

bam pushed a commit to branch master
in repository django-celery.

commit 06566a57ca296c8ac4eb59c7b386f4dca817b555
Author: Brian May <bam at debian.org>
Date:   Thu Feb 23 07:52:29 2017 +1100

    Fix management command handling for django >= 1.10
    
    Patch applied from upstream:
    https://patch-diff.githubusercontent.com/raw/celery/django-celery/pull/458.patch
---
 djcelery/management/base.py | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/djcelery/management/base.py b/djcelery/management/base.py
index 11520f1..b3f386d 100644
--- a/djcelery/management/base.py
+++ b/djcelery/management/base.py
@@ -57,7 +57,29 @@ patch_thread_ident()
 
 
 class CeleryCommand(BaseCommand):
-    options = BaseCommand.option_list
+    options = ()
+    if hasattr(BaseCommand, 'option_list'):
+        options = BaseCommand.option_list
+    else:
+        def add_arguments(self, parser):
+            option_typemap = {
+                "string": str,
+                "int": int,
+                "float": float
+            }
+            for opt in self.option_list:
+                option = {k: v
+                          for k, v in opt.__dict__.items()
+                          if v is not None}
+                flags = (option.get("_long_opts", []) +
+                         option.get("_short_opts", []))
+                del option["_long_opts"]
+                del option["_short_opts"]
+                if "type" in option:
+                    opttype = option["type"]
+                    option["type"] = option_typemap.get(opttype, opttype)
+                parser.add_argument(*flags, **option)
+
     skip_opts = ['--app', '--loader', '--config', '--no-color']
     requires_model_validation = VALIDATE_MODELS
     keep_base_opts = False

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-celery.git



More information about the Python-modules-commits mailing list