summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-08-06 23:30:17 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-08-06 23:30:17 (GMT)
commit1d3d88ced320e151cf1b8ef53f15b4bee9e77a4e (patch)
tree1c3e5cdc4180714ce6ba8c0693b82493716e7ceb
parent06794d2351ee9db2b62aaacf554d4671e9174b80 (diff)
downloadpykolab-1d3d88ced320e151cf1b8ef53f15b4bee9e77a4e.tar.gz
Send delegation reply BEFORE the delegatee's accept reply; improve error logging; fixed a typo
-rw-r--r--wallace/module_invitationpolicy.py3
-rw-r--r--wallace/module_resources.py25
2 files changed, 14 insertions, 14 deletions
diff --git a/wallace/module_invitationpolicy.py b/wallace/module_invitationpolicy.py
index 6dfc111..8e77335 100644
--- a/wallace/module_invitationpolicy.py
+++ b/wallace/module_invitationpolicy.py
@@ -24,6 +24,7 @@ import time
from urlparse import urlparse
import urllib
import hashlib
+import traceback
from email import message_from_string
from email.parser import Parser
@@ -697,7 +698,7 @@ def find_existing_event(uid, user_rec, lock=False):
setattr(event, '_imap_folder', folder)
setattr(event, '_lock_key', lock_key)
except Exception, e:
- log.error(_("Failed to parse event from message %s/%s: %r") % (folder, num, e))
+ log.error(_("Failed to parse event from message %s/%s: %s") % (folder, num, traceback.format_exc()))
continue
if event and event.uid == uid:
diff --git a/wallace/module_resources.py b/wallace/module_resources.py
index ae6cd06..f38ae31 100644
--- a/wallace/module_resources.py
+++ b/wallace/module_resources.py
@@ -1040,25 +1040,24 @@ def send_response(from_address, itip_events, owner=None):
message_text = reservation_response_text(participant_status, owner)
subject_template = _("Reservation Request for %(summary)s was %(status)s")
+ # Extra actions to take: send delegated reply
if participant_status == "DELEGATED":
- # Extra actions to take
- delegator = itip_event['xml'].get_attendee_by_email(from_address)
- delegatee = [a for a in itip_event['xml'].get_attendees() if from_address in [b.email() for b in a.get_delegated_from()]][0]
- delegatee_status = itip_event['xml'].get_ical_attendee_participant_status(delegatee)
+ delegatee = [a for a in itip_event['xml'].get_attendees() if from_address in a.get_delegated_from(True)][0]
- pykolab.itip.send_reply(delegatee.get_email(), itip_event, reservation_response_text(delegatee_status, owner),
- subject=subject_template)
-
- # restore list of attendees after to_message_itip()
- itip_event['xml']._attendees = [ delegator, delegatee ]
- itip_event['xml'].event.setAttendees(itip_event['xml']._attendees)
-
- message_text = _("""
+ delegated_message_text = _("""
*** This is an automated response, please do not reply! ***
Your reservation was delegated to "%s" which is available for the requested time.
""") % (delegatee.get_name())
+ pykolab.itip.send_reply(from_address, itip_event, delegated_message_text,
+ subject=subject_template)
+
+ # adjust some vars for the regular reply from the delegatee
+ message_text = reservation_response_text(delegatee.get_participant_status(True), owner)
+ from_address = delegatee.get_email()
+ time.sleep(2)
+
pykolab.itip.send_reply(from_address, itip_event, message_text,
subject=subject_template)
@@ -1196,7 +1195,7 @@ def send_owner_confirmation(resource, owner, itip_event):
message_text = _("""
A reservation request for %(resource)s requires your approval!
- Please either accept or decline this inivitation without saving it to your calendar.
+ Please either accept or decline this invitation without saving it to your calendar.
The reservation request was sent from %(orgname)s <%(orgemail)s>.