Skip to content

Commit

Permalink
Fix celery#325 ImportError: cannot import name 'timedelta_seconds'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfischer-ch committed Jun 10, 2014
1 parent 415f700 commit 398fb46
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions djcelery/backends/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.core.cache import cache, get_cache

from celery import current_app
from celery.utils.timeutils import timedelta_seconds
from celery.backends.base import KeyValueStoreBackend

# CELERY_CACHE_BACKEND overrides the django-global(tm) backend settings.
Expand Down Expand Up @@ -55,7 +54,7 @@ def __init__(self, *args, **kwargs):
expires = kwargs.get('expires',
current_app.conf.CELERY_TASK_RESULT_EXPIRES)
if isinstance(expires, timedelta):
expires = int(timedelta_seconds(expires))
expires = int(timedelta.total_seconds(expires))
self.expires = expires

def get(self, key):
Expand Down
3 changes: 1 addition & 2 deletions djcelery/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from celery import schedules
from celery import states
from celery.events.state import heartbeat_expires
from celery.utils.timeutils import timedelta_seconds

from . import managers
from .picklefield import PickledObjectField
Expand Down Expand Up @@ -104,7 +103,7 @@ def schedule(self):

@classmethod
def from_schedule(cls, schedule, period='seconds'):
every = timedelta_seconds(schedule.run_every)
every = timedelta.total_seconds(schedule.run_every)
try:
return cls.objects.get(every=every, period=period)
except cls.DoesNotExist:
Expand Down
3 changes: 1 addition & 2 deletions djcelery/tests/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from celery.five import monotonic
from celery.schedules import schedule, crontab
from celery.utils.timeutils import timedelta_seconds

from djcelery import schedulers
from djcelery import celery
Expand Down Expand Up @@ -245,7 +244,7 @@ def test_PeriodicTask_unicode_crontab(self):
def test_PeriodicTask_schedule_property(self):
p1 = create_model_interval(schedule(timedelta(seconds=10)))
s1 = p1.schedule
self.assertEqual(timedelta_seconds(s1.run_every), 10)
self.assertEqual(timedelta.total_seconds(s1.run_every), 10)

p2 = create_model_crontab(crontab(hour='4, 5',
minute='10,20,30',
Expand Down

0 comments on commit 398fb46

Please sign in to comment.