Author: eallen
Date: 2008-10-31 17:18:35 -0400 (Fri, 31 Oct 2008)
New Revision: 2718
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Fixed malformed xml that resulted when soft breaks ​ were inserted in an entity
ref like &
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-31 16:57:11 UTC (rev 2717)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-31 21:18:35 UTC (rev 2718)
@@ -604,15 +604,17 @@
if property.renderer:
value = property.renderer(session, value)
ret = escape_entity(str(value))
- #return ret # XXX
return self.insert_breaks(ret)
def insert_breaks(self, value):
subwords = list()
- while len(value) > 40:
- subwords.append(value[:40])
- value = value[40:]
- subwords.append(value)
+ snippets = parse(value, begin_delim="&", end_delim=";")
+ for snippet in snippets:
+ while len(snippet) > 40:
+ subwords.append(snippet[:40])
+ snippet = snippet[40:]
+ subwords.append(snippet)
+
return "​".join(subwords)
def render_inline_help(self, session, item):
@@ -636,17 +638,18 @@
def do_get_items(self, session, args):
job = args[0]
group = args[1]
- all_items = super(JobAdsViewer, self).do_get_items(session, job)
group_items = list()
- for item in all_items:
- if "property" in item:
- property = item["property"]
- item_group = property.group
- else:
- item_group = "Other"
- if item_group == group:
- group_items.append(item)
-
+ if job:
+ all_items = super(JobAdsViewer, self).do_get_items(session, job)
+ for item in all_items:
+ if "property" in item:
+ property = item["property"]
+ item_group = property.group
+ else:
+ item_group = "Other"
+ if item_group == group:
+ group_items.append(item)
+
return group_items
def render_properties(self, session, *args):
Show replies by date