summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-03-05 12:44:09 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2014-03-05 12:44:09 -0500
commit5e9e21061bfe45f05c4e0f2567f3838ec57e9a19 (patch)
treeab516b5f4b6e0ce9bedde5acb7cf500369f20369 /pykolab
parentb3afa468579586b62aee849779c89d0104c3d21e (diff)
downloadpykolab-5e9e21061bfe45f05c4e0f2567f3838ec57e9a19.tar.gz
Test owner assignment for resources and mentions in reservation request responses
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/utils.py11
-rw-r--r--pykolab/xml/event.py4
2 files changed, 9 insertions, 6 deletions
diff --git a/pykolab/utils.py b/pykolab/utils.py
index b7ff468..d552bff 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -280,8 +280,6 @@ def generate_password():
return output
def multiline_message(message):
- _msg = ""
-
column_width = 80
# First, replace all occurences of "\n"
@@ -289,8 +287,6 @@ def multiline_message(message):
message = message.replace("\n", " ")
lines = []
- line_length = 0
-
line = ""
for word in message.split():
if (len(line) + len(word)) > column_width:
@@ -306,6 +302,13 @@ def multiline_message(message):
return "\n%s\n" % ("\n".join(lines))
+def stripped_message(message):
+ lines = []
+ for line in message.strip().split("\n"):
+ lines.append(multiline_message(line).strip())
+
+ return "\n%s\n" % ("\n".join(lines))
+
def normalize(_object):
if type(_object) == list:
result = []
diff --git a/pykolab/xml/event.py b/pykolab/xml/event.py
index a165bcf..2218400 100644
--- a/pykolab/xml/event.py
+++ b/pykolab/xml/event.py
@@ -779,14 +779,14 @@ class Event(object):
msg['Date'] = formatdate(localtime=True)
if subject is None:
- subject = _("Reservation Request for %s was %s") % (self.get_summary(), participant_status)
+ subject = _("Reservation Request for %s was %s") % (self.get_summary(), _(participant_status))
msg["Subject"] = subject
if message_text is None:
message_text = _("""This is an automated response to one of your event requests.""")
- msg.attach(MIMEText(utils.multiline_message(message_text)))
+ msg.attach(MIMEText(utils.stripped_message(message_text)))
part = MIMEBase('text', 'calendar', charset='UTF-8', method=method)
del part['MIME-Version'] # mime parts don't need this