Skip to content

Commit caa6ac8

Browse files
author
Johnny Liu
authored
Merge pull request #11 from milind-shakya-sp/debug_restart_issue
Introduce maybe_make_naive
2 parents 4365a43 + 7266b71 commit caa6ac8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

django_celery_beat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from collections import namedtuple
1212

13-
__version__ = '1.4.0+singleplatform.2'
13+
__version__ = '1.4.0+singleplatform.3'
1414
__author__ = 'Ask Solem'
1515
__contact__ = '[email protected]'
1616
__homepage__ = 'https://github.com/celery/django-celery-beat'

django_celery_beat/models.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import absolute_import, unicode_literals
33

44
from datetime import timedelta
5+
import dateutil
56

67
import timezone_field
78
from celery import schedules
@@ -117,13 +118,19 @@ def maybe_make_aware(self, dt):
117118
return dt
118119

119120

121+
def maybe_make_naive(dt):
122+
if dt and dt.tzinfo:
123+
dt = dt.replace(tzinfo=None)
124+
return dt
125+
126+
120127
class TZNaiveCronSchedule(schedules.crontab):
121128

122129
def maybe_make_aware(self, dt):
123130
"""
124131
Overriding the base method, to be a no-op and returning the dt as is.
125132
"""
126-
return dt
133+
return maybe_make_naive(dt)
127134

128135

129136
@python_2_unicode_compatible

0 commit comments

Comments
 (0)