Closed bctiemann closed 8 years ago
Doesn't it break backward-compatibility? Looks like it did. Because add_arguments
was added in Django 1.8.
@bctiemann do you know recommended way to check Django version and depending on it define or not define attributes and functions?
I'm not sure if there's a canonical way, but what if you check whether the add_arguments method is defined in the BaseCommand superclass?
@bctiemann thanks for your suggestion!
Django 1.10 has now been released, and this issue no longer is a deprecation warning; it breaks django-cron on Django 1.10. Upon running the manage.py runcrons
, I get:
AttributeError: type object 'BaseCommand' has no attribute 'option_list'
Could a fixed release be made available? That would be greatly appreciated!
BTW, it seems to be common to check Django's version using django.get_version()
(string) or django.VERSION
(tuple) to support multiple versions and avoid breaking backward compatibility, e.g.:
if django.get_version().split('.') < ['1', '10']:
# old version friendly code
else:
# new version friendly code
@akhayyat - acknowledged and we'll work on a fix asap.
The fix is deployed https://pypi.python.org/pypi/django-cron/
Works perfectly! Thank you very much for the prompt resolution.
Running runcrons:
.../venv/lib/python2.7/site-packages/django/core/management/base.py:265: RemovedInDjango110Warning: OptionParser usage for Django management commands is deprecated, use ArgumentParser instead RemovedInDjango110Warning)
Looks like all you need to do is replace the "option_list" block at the top of the Command class with: