summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2011-06-26 12:27:46 -0400
committerShaun McCance <shaunm@gnome.org>2011-06-26 12:27:46 -0400
commitb57dfa4327da4d889dbfc5d26d824482fd7b2f54 (patch)
tree1e8d90fbb484dd3e3490250d78bb2ca94724e3e4
parent8d97758ac43f2079d252fedf2a9666b33a751fd0 (diff)
downloaditstool-b57dfa4327da4d889dbfc5d26d824482fd7b2f54.tar.gz
Don't bomb if a locNotePointer returns a string
-rwxr-xr-xitstool.in22
1 files changed, 13 insertions, 9 deletions
diff --git a/itstool.in b/itstool.in
index 54117a5..2401918 100755
--- a/itstool.in
+++ b/itstool.in
@@ -390,15 +390,19 @@ class Document (object):
except:
oldnode = None
xpath.setContextNode(node)
- for note in self._try_xpath_eval(xpath, sel):
- if self.get_preserve_space(note):
- cont = note.content
- else:
- cont = re.sub('\s+', ' ', note.content).strip()
- if ref:
- cont = 'SEE: ' + cont
- self._its_loc_notes[node] = cont
- break
+ note = self._try_xpath_eval(xpath, sel)
+ if isinstance(note, basestring):
+ self._its_loc_notes[node] = note
+ else:
+ for note in note:
+ if self.get_preserve_space(note):
+ cont = note.content
+ else:
+ cont = re.sub('\s+', ' ', note.content).strip()
+ if ref:
+ cont = 'SEE: ' + cont
+ self._its_loc_notes[node] = cont
+ break
xpath.setContextNode(oldnode)
elif xml_is_ns_name(rule, NS_ITS, 'langRule'):
if rule.prop('selector') is not None and rule.prop('langPointer') is not None: