2 commits - pykolab/xml wallace/module_invitationpolicy.py wallace/module_resources.py
Thomas Brüderli
bruederli at kolabsys.com
Thu Aug 7 12:33:45 CEST 2014
pykolab/xml/attendee.py | 2 +-
pykolab/xml/contact_reference.py | 6 +++---
wallace/module_invitationpolicy.py | 3 ++-
wallace/module_resources.py | 25 ++++++++++++-------------
4 files changed, 18 insertions(+), 18 deletions(-)
New commits:
commit 1d3d88ced320e151cf1b8ef53f15b4bee9e77a4e
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Wed Aug 6 19:30:17 2014 -0400
Send delegation reply BEFORE the delegatee's accept reply; improve error logging; fixed a typo
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>.
commit 06794d2351ee9db2b62aaacf554d4671e9174b80
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Wed Aug 6 19:29:19 2014 -0400
Fix cloning attendees (name got lost)
diff --git a/pykolab/xml/attendee.py b/pykolab/xml/attendee.py
index 087e832..a6384e9 100644
--- a/pykolab/xml/attendee.py
+++ b/pykolab/xml/attendee.py
@@ -110,7 +110,7 @@ class Attendee(kolabformat.Attendee):
if isinstance(obj, kolabformat.Attendee):
self.contactreference = ContactReference(obj.contact())
self.email = self.contactreference.get_email()
- kolabformat.Attendee.__init__(self, self.contactreference)
+ self.setContact(self.contactreference)
# manually copy all properities, copy constructor doesn't work :-(
self.setRSVP(obj.rsvp())
diff --git a/pykolab/xml/contact_reference.py b/pykolab/xml/contact_reference.py
index 5a832da..42d9919 100644
--- a/pykolab/xml/contact_reference.py
+++ b/pykolab/xml/contact_reference.py
@@ -18,13 +18,13 @@ class ContactReference(kolabformat.ContactReference):
'uid': 'uid',
}
- def __init__(self, email=None):
+ def __init__(self, email=None, name=""):
if email == None:
kolabformat.ContactReference.__init__(self)
elif isinstance(email, kolabformat.ContactReference):
kolabformat.ContactReference.__init__(self, email.email(), email.name(), email.uid())
else:
- kolabformat.ContactReference.__init__(self, email)
+ kolabformat.ContactReference.__init__(self, email, name)
def get_email(self):
return self.email()
@@ -36,7 +36,7 @@ class ContactReference(kolabformat.ContactReference):
self.setName(value)
def set_email(self, email):
- kolabformat.ContactReference.__init__(self, email)
+ kolabformat.ContactReference.__init__(self, email, self.name(), self.uid())
def set_name(self, name):
self.setName(name)
More information about the commits
mailing list