datetime->timezone in model policies
diff --git a/xos/synchronizers/base/syncstep-portal.py b/xos/synchronizers/base/syncstep-portal.py
index dfb810e..07abb0b 100644
--- a/xos/synchronizers/base/syncstep-portal.py
+++ b/xos/synchronizers/base/syncstep-portal.py
@@ -5,6 +5,7 @@
from xos.logger import Logger, logging
from synchronizers.base.steps import *
from django.db.models import F, Q
+from django.utils import timezone
from core.models import *
from django.db import reset_queries
import json
@@ -141,7 +142,7 @@
o.delete(purge=True)
else:
self.sync_record(o)
- o.enacted = datetime.now() # Is this the same timezone? XXX
+ o.enacted = timezone.now() # Is this the same timezone? XXX
scratchpad = {'next_run':0, 'exponent':0}
o.backend_register = json.dumps(scratchpad)
o.backend_status = "1 - OK"
diff --git a/xos/synchronizers/model_policy.py b/xos/synchronizers/model_policy.py
index 8faae81..ef31d41 100644
--- a/xos/synchronizers/model_policy.py
+++ b/xos/synchronizers/model_policy.py
@@ -5,6 +5,7 @@
from synchronizers.openstack import model_policies
from xos.logger import logger
from datetime import datetime
+from django.utils import timezone
import time
from core.models import *
from django.db import reset_queries
@@ -87,7 +88,7 @@
logger.log_exc("Model Policy Error:")
try:
- instance.policed=datetime.now()
+ instance.policed=timezone.now()
instance.save(update_fields=['policed'])
except:
logging.error('Object %r is defective'%instance)