[rhmessaging-commits] rhmessaging commits: r4139 - mgmt/newdata/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Jul 21 10:12:55 EDT 2010


Author: justi9
Date: 2010-07-21 10:12:55 -0400 (Wed, 21 Jul 2010)
New Revision: 4139

Modified:
   mgmt/newdata/cumin/python/cumin/objectframe.py
Log:
Handle long lines in attribute values

Modified: mgmt/newdata/cumin/python/cumin/objectframe.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/objectframe.py	2010-07-21 09:24:04 UTC (rev 4138)
+++ mgmt/newdata/cumin/python/cumin/objectframe.py	2010-07-21 14:12:55 UTC (rev 4139)
@@ -108,8 +108,28 @@
         if value is None:
             return fmt_none()
 
+        if isinstance(value, str):
+            value = self.break_up_long_lines(value)
+
         return xml_escape(str(value))
 
+    def break_up_long_lines(self, string):
+        if " " in string[0:80]:
+            return string
+
+        lines = list()
+
+        length = len(string)
+        prev = 0
+
+        for curr in range(80, length, 80):
+            lines.append(string[prev:curr])
+            prev = curr
+
+        lines.append(string[prev:length])
+
+        return " ".join(lines)
+
 class ObjectTasks(Widget):
     def __init__(self, app, name, object):
         super(ObjectTasks, self).__init__(app, name)



More information about the rhmessaging-commits mailing list