Permalink
Browse files

Utilização de timezones nos objetos datetime

  • Loading branch information...
1 parent bdcbcb3 commit 3c937d459131475e3f57f9e2ba6d3091f756b67d @gustavofonseca committed Mar 25, 2013
@@ -4,3 +4,11 @@ HTML_MINIFY = not DEBUG
ALLOWED_HOSTS = ['*']
+from datetime import timedelta
+CELERYBEAT_SCHEDULE = {
+ 'update-catalog': {
+ 'task': 'utils.tasks.update_catalog',
+ 'schedule': timedelta(minutes=60),
+ 'args': ()
+ },
+}
@@ -64,6 +64,9 @@ ASSETS_DEBUG = DEBUG
#
HTML_MINIFY = not DEBUG
+#
+# Fixture discovery
+#
FIXTURE_DIRS = (
os.path.join(PROJECT_PATH, 'fixtures', ''),
)
View
No changes.
View
@@ -1,12 +1,11 @@
-import datetime
-
+from django.utils import timezone
from django.conf import settings
from django.db import transaction
from celery import task
from .sync import datacollector
from .sync import dataloader
-from . import functions
+import functions
from catalog import models
@@ -25,7 +24,7 @@ def build_catalog():
marreta = dataloader.Marreta(settings=settings)
marreta.rebuild_collection('journals', transformed_data)
- models.Sync.objects.create(ended_at=datetime.datetime.now(),
+ models.Sync.objects.create(ended_at=timezone.now(),
last_seq=functions.get_remote_last_seq(), status='finished')
@@ -58,7 +57,7 @@ def update_catalog(managerapi_dep=datacollector.SciELOManagerAPI):
sync.last_seq = changes.last_seq
sync.status = 'finished'
- sync.ended_at = datetime.datetime.now()
+ sync.ended_at = timezone.now()
sync.save()

0 comments on commit 3c937d4

Please sign in to comment.