From 204e6e646064200ba26968d796519530b081f5ef Mon Sep 17 00:00:00 2001 From: Maxim Kukhtenkov Date: Tue, 13 Sep 2016 16:16:55 -0700 Subject: [PATCH 1/4] Use add_arguments instead of option_list in management command --- django_cron/management/commands/runcrons.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/django_cron/management/commands/runcrons.py b/django_cron/management/commands/runcrons.py index aaf8fc7..61ce039 100644 --- a/django_cron/management/commands/runcrons.py +++ b/django_cron/management/commands/runcrons.py @@ -1,4 +1,3 @@ -from optparse import make_option import traceback from datetime import timedelta @@ -16,10 +15,17 @@ class Command(BaseCommand): - option_list = BaseCommand.option_list + ( - make_option('--force', action='store_true', help='Force cron runs'), - make_option('--silent', action='store_true', help='Do not push any message on console'), - ) + def add_arguments(self, parser): + parser.add_argument( + '--force', + action='store_true', + help='Force cron runs' + ) + parser.add_argument( + '--silent', + action='store_true', + help='Do not push any message on console' + ) def handle(self, *args, **options): """ From 6a973f905c4dec0a2ea406c3048488d6dcddb353 Mon Sep 17 00:00:00 2001 From: Maxim Kukhtenkov Date: Tue, 13 Sep 2016 17:56:20 -0700 Subject: [PATCH 2/4] Changes to support Django 1.10 + change .travis.yml config + fix getting cron_class_names args + fix unit tests --- .travis.yml | 6 +++--- django_cron/management/commands/runcrons.py | 9 +++++++-- test_urls.py | 9 ++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 80aba62..74d3685 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,15 +4,15 @@ python: - "2.7" - "3.4" env: - - DJANGO=1.7.11 DJANGO_SETTINGS_MODULE='settings_sqllite' - - DJANGO=1.7.11 DJANGO_SETTINGS_MODULE='settings_postgres' - - DJANGO=1.7.11 DJANGO_SETTINGS_MODULE='settings_mysql' - DJANGO=1.8.7 DJANGO_SETTINGS_MODULE='settings_sqllite' - DJANGO=1.8.7 DJANGO_SETTINGS_MODULE='settings_postgres' - DJANGO=1.8.7 DJANGO_SETTINGS_MODULE='settings_mysql' - DJANGO=1.9 DJANGO_SETTINGS_MODULE='settings_sqllite' - DJANGO=1.9 DJANGO_SETTINGS_MODULE='settings_postgres' - DJANGO=1.9 DJANGO_SETTINGS_MODULE='settings_mysql' + - DJANGO=1.10.1 DJANGO_SETTINGS_MODULE='settings_sqllite' + - DJANGO=1.10.1 DJANGO_SETTINGS_MODULE='settings_postgres' + - DJANGO=1.10.1 DJANGO_SETTINGS_MODULE='settings_mysql' addons: - postgresql: "9.3" install: diff --git a/django_cron/management/commands/runcrons.py b/django_cron/management/commands/runcrons.py index 61ce039..3088774 100644 --- a/django_cron/management/commands/runcrons.py +++ b/django_cron/management/commands/runcrons.py @@ -16,6 +16,10 @@ class Command(BaseCommand): def add_arguments(self, parser): + parser.add_argument( + 'cron_classes', + nargs='*', + ) parser.add_argument( '--force', action='store_true', @@ -32,8 +36,9 @@ def handle(self, *args, **options): Iterates over all the CRON_CLASSES (or if passed in as a commandline argument) and runs them. """ - if args: - cron_class_names = args + cron_classes = options['cron_classes'] + if cron_classes: + cron_class_names = cron_classes else: cron_class_names = getattr(settings, 'CRON_CLASSES', []) diff --git a/test_urls.py b/test_urls.py index fc0109f..1ba5bcb 100644 --- a/test_urls.py +++ b/test_urls.py @@ -1,10 +1,9 @@ # urls.py -from django.conf.urls import patterns, include +from django.conf.urls import include, url from django.contrib import admin admin.autodiscover() -urlpatterns = patterns( - '', - (r'^admin/', include(admin.site.urls)), -) +urlpatterns = [ + url(r'^admin/', include(admin.site.urls)), +] From 322a1e46b05b75db6ec76963b219cd0fb8ee5e3b Mon Sep 17 00:00:00 2001 From: Maxim Kukhtenkov Date: Tue, 13 Sep 2016 19:03:18 -0700 Subject: [PATCH 3/4] Fix unit tests for Django 1.10 and update installation requirements + Add 1.8 style TEMPLATES settings key to test settings + Add Django >=1.8.0 requirement --- settings_base.py | 9 +++++++++ setup.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/settings_base.py b/settings_base.py index bd88c71..4b2221d 100644 --- a/settings_base.py +++ b/settings_base.py @@ -53,6 +53,15 @@ } } +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': {}, + }, +] + ROOT_URLCONF = 'test_urls' SITE_ID = 1 STATIC_URL = '/static/' diff --git a/setup.py b/setup.py index cbf3af3..642ac55 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ keywords='django cron', zip_safe=False, install_requires=[ - 'Django>=1.7.0', + 'Django>=1.8.0', 'django-common-helpers>=0.6.4' ], test_suite='runtests.runtests', From 518965a97379173776f8ec7bfe2ec2d53d5d49c9 Mon Sep 17 00:00:00 2001 From: Maxim Kukhtenkov Date: Wed, 14 Sep 2016 10:38:43 -0700 Subject: [PATCH 4/4] Update configs and changelog for version 0.5.0 --- django_cron/management/commands/runcrons.py | 2 +- docs/changelog.rst | 10 ++++++++++ setup.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/django_cron/management/commands/runcrons.py b/django_cron/management/commands/runcrons.py index 3088774..4fff4a6 100644 --- a/django_cron/management/commands/runcrons.py +++ b/django_cron/management/commands/runcrons.py @@ -18,7 +18,7 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( 'cron_classes', - nargs='*', + nargs='*' ) parser.add_argument( '--force', diff --git a/docs/changelog.rst b/docs/changelog.rst index 129fd3d..72ba4f2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,5 +1,15 @@ Changelog ========= +0.5.0 +------ + + - Added support for Django 1.10 + + - Minimum Django version required is 1.8 + + - Use parser.add_argument() instead of optparse.make_option() in runcrons command + + 0.4.6 ------ diff --git a/setup.py b/setup.py index 642ac55..d4731f1 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup( name='django-cron', - version='0.4.6', + version='0.5.0', author='Sumit Chachra', author_email='chachra@tivix.com', url='http://github.com/tivix/django-cron',