summaryrefslogtreecommitdiffstats
path: root/pykolab/utils.py
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/utils.py
parentb3afa468579586b62aee849779c89d0104c3d21e (diff)
downloadpykolab-5e9e21061bfe45f05c4e0f2567f3838ec57e9a19.tar.gz
Test owner assignment for resources and mentions in reservation request responses
Diffstat (limited to 'pykolab/utils.py')
-rw-r--r--pykolab/utils.py11
1 files changed, 7 insertions, 4 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 = []