r5435 - trunk/cumin/python/cumin

croberts at fedoraproject.org croberts at fedoraproject.org
Wed Jul 25 17:48:54 UTC 2012


Author: croberts
Date: 2012-07-25 17:48:53 +0000 (Wed, 25 Jul 2012)
New Revision: 5435

Modified:
   trunk/cumin/python/cumin/formats.py
   trunk/cumin/python/cumin/widgets.py
Log:
For BZ:800611 we are now producing valid XHTML when displaying a long queue name on the add binding form.  This is being done by omitting the span tag that was causing the problem when it was added to the value attribute.

Modified: trunk/cumin/python/cumin/formats.py
===================================================================
--- trunk/cumin/python/cumin/formats.py	2012-07-16 13:50:47 UTC (rev 5434)
+++ trunk/cumin/python/cumin/formats.py	2012-07-25 17:48:53 UTC (rev 5435)
@@ -111,13 +111,18 @@
 def fmt_none_brief():
     return "<span class=\"none\">&ndash;</span>"
 
-def fmt_shorten(string, pre=16, post=4):
+def fmt_shorten(string, pre=16, post=4, spanify=True):
     if len(string) > pre + post:
         if post:
-            string = "<span title=\"%s\">%s</span>" % (string, string[:pre] + "&#8230;" + string[-post:])
+            if spanify:
+                string = "<span title=\"%s\">%s</span>" % (string, string[:pre] + "&#8230;" + string[-post:])
+            else:
+                string = "%s" % string[:pre] + "&#8230;" + string[-post:]
         else:
-            string = "<span title=\"%s\">%s</span>" % (string, string[:pre] + "&#8230;")
-
+            if spanify:
+                string = "<span title=\"%s\">%s</span>" % (string, string[:pre] + "&#8230;")
+            else:
+                string = "%s" % string[:pre] + "&#8230;"
     return string
 
 def fmt_link(href, content, class_="", id="", link_title="", bm="", click="", attribs={}):

Modified: trunk/cumin/python/cumin/widgets.py
===================================================================
--- trunk/cumin/python/cumin/widgets.py	2012-07-16 13:50:47 UTC (rev 5434)
+++ trunk/cumin/python/cumin/widgets.py	2012-07-25 17:48:53 UTC (rev 5435)
@@ -1533,7 +1533,7 @@
         if self.disabled:
             field = self.form.object.get(session)
             return fmt_shorten(field.get_formatted_value("name", escape=True),
-                                          pre=36, post=4)
+                                          pre=36, post=4, spanify=False)
         else:
             input_value = self.param.get(session)
             return input_value and xml_escape(input_value) or ""



More information about the cumin-developers mailing list