summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-07-10 05:00:39 -0400
committerThomas Bruederli <bruederli@kolabsys.com>2014-07-10 05:00:39 -0400
commita44dcfb0690305fe42f3b374cef0fbced465d64d (patch)
tree85a0367f36af7af3a9a52c9c681199b7d70db171
parent214bde4656f3e3a10096ba54dfa2704f4e8de719 (diff)
downloadpykolab-a44dcfb0690305fe42f3b374cef0fbced465d64d.tar.gz
Fix all-day event date checks
-rw-r--r--pykolab/itip/__init__.py7
-rw-r--r--tests/unit/test-011-itip.py6
2 files changed, 10 insertions, 3 deletions
diff --git a/pykolab/itip/__init__.py b/pykolab/itip/__init__.py
index 8cf6435..17da24e 100644
--- a/pykolab/itip/__init__.py
+++ b/pykolab/itip/__init__.py
@@ -3,6 +3,7 @@ import pykolab
from pykolab.xml import to_dt
from pykolab.xml import event_from_ical
+from pykolab.xml import participant_status_label
from pykolab.translate import _
log = pykolab.getLogger('pykolab.wallace')
@@ -144,7 +145,7 @@ def check_event_conflict(kolab_event, itip_event):
return conflict
_es = to_dt(kolab_event.get_start())
- _ee = to_dt(kolab_event.get_end())
+ _ee = to_dt(kolab_event.get_ical_dtend()) # use iCal style end date: next day for all-day events
# naive loops to check for collisions in (recurring) events
# TODO: compare recurrence rules directly (e.g. matching time slot or weekday or monthday)
@@ -208,10 +209,10 @@ def send_reply(from_address, itip_events, response_text, subject=None):
participant_status = itip_event['xml'].get_ical_attendee_participant_status(attendee)
event_summary = itip_event['xml'].get_summary()
- message_text = response_text % { 'summary':event_summary, 'status':_(participant_status), 'name':attendee.get_name() }
+ message_text = response_text % { 'summary':event_summary, 'status':participant_status_label(participant_status), 'name':attendee.get_name() }
if subject is not None:
- subject = subject % { 'summary':event_summary, 'status':_(participant_status), 'name':attendee.get_name() }
+ subject = subject % { 'summary':event_summary, 'status':participant_status_label(participant_status), 'name':attendee.get_name() }
try:
message = itip_event['xml'].to_message_itip(from_address,
diff --git a/tests/unit/test-011-itip.py b/tests/unit/test-011-itip.py
index abbaa92..a120fd2 100644
--- a/tests/unit/test-011-itip.py
+++ b/tests/unit/test-011-itip.py
@@ -357,6 +357,12 @@ class TestITip(unittest.TestCase):
event.set_uid(itip_event['uid'])
self.assertFalse(itip.check_event_conflict(event, itip_event), "No conflict for same UID")
+ allday = Event()
+ allday.set_start(datetime.date(2012,7,13))
+ allday.set_end(datetime.date(2012,7,13))
+
+ self.assertTrue(itip.check_event_conflict(allday, itip_event), "Conflicting allday event")
+
event2 = Event()
event2.set_start(datetime.datetime(2012,7,13, 10,0,0, tzinfo=pytz.timezone("US/Central")))
event2.set_end(datetime.datetime(2012,7,13, 11,0,0, tzinfo=pytz.timezone("US/Central")))