summaryrefslogtreecommitdiffstats
path: root/wallace/module_resources.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-13 13:43:32 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-13 13:43:32 +0200
commit2f9376cdfaca44939041cf9c809cb83a148af108 (patch)
tree3e4f711a1559a6e86ad1dd3e94ffa73ddb157c92 /wallace/module_resources.py
parentbbabfa8913b349c79023df2fcfba79b257ddc7d4 (diff)
downloadpykolab-2f9376cdfaca44939041cf9c809cb83a148af108.tar.gz
Use utility function to_dt() before comparing es/is/ee/es, greatly simplifying this part of the code
Make sure we have append permissions
Diffstat (limited to 'wallace/module_resources.py')
-rw-r--r--wallace/module_resources.py31
1 files changed, 8 insertions, 23 deletions
diff --git a/wallace/module_resources.py b/wallace/module_resources.py
index bf0b59d..1641be1 100644
--- a/wallace/module_resources.py
+++ b/wallace/module_resources.py
@@ -21,6 +21,7 @@ import datetime
import icalendar
import json
import os
+import pytz
import random
import tempfile
import time
@@ -41,6 +42,7 @@ from pykolab.conf import Conf
from pykolab.imap import IMAP
from pykolab.xml import event_from_ical
from pykolab.xml import event_from_string
+from pykolab.xml import to_dt
from pykolab.translate import _
log = pykolab.getLogger('pykolab.wallace')
@@ -231,31 +233,12 @@ def execute(*args, **kw):
event = pykolab.xml.event_from_string(payload)
for itip in itip_events:
- _es = event.get_start()
- _is = itip['start'].dt
+ _es = to_dt(event.get_start())
+ _is = to_dt(itip['start'].dt)
- if type(_es) == 'datetime.date' or not hasattr(_es, 'hour'):
- _es = datetime.datetime(
- _es.year, _es.month, _es.day, 0, 0, 0
- )
-
- if type(_is) == 'datetime.date' or not hasattr(_is, 'hour'):
- _is = datetime.datetime(
- _is.year, _is.month, _is.day, 0, 0, 0
- )
-
- _ee = event.get_end()
- _ie = itip['end'].dt
+ _ee = to_dt(event.get_end())
+ _ie = to_dt(itip['end'].dt)
- if type(_ee) == 'datetime.date' or not hasattr(_ee, 'hour'):
- _ee = datetime.datetime(
- _ee.year, _ee.month, _ee.day, 0, 0, 0
- )
-
- if type(_ie) == 'datetime.date' or not hasattr(_ie, 'hour'):
- _ie = datetime.datetime(
- _ie.year, _ie.month, _ie.day, 0, 0, 0
- )
if _es < _is:
if _es <= _ie:
@@ -360,6 +343,7 @@ def execute(*args, **kw):
level=9
)
+ imap.imap.m.setacl(resources[resource]['kolabtargetfolder'], "cyrus-admin", "lrswipkxtecda")
imap.imap.m.append(
resources[resource]['kolabtargetfolder'],
None,
@@ -395,6 +379,7 @@ def execute(*args, **kw):
level=9
)
+ imap.imap.m.setacl(_target_resource['kolabtargetfolder'], "cyrus-admin", "lrswipkxtecda")
imap.imap.m.append(
_target_resource['kolabtargetfolder'],
None,