diff options
author | Shaun McCance <shaunm@gnome.org> | 2011-06-26 12:27:46 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2011-06-26 12:27:46 -0400 |
commit | b57dfa4327da4d889dbfc5d26d824482fd7b2f54 (patch) | |
tree | 1e8d90fbb484dd3e3490250d78bb2ca94724e3e4 | |
parent | 8d97758ac43f2079d252fedf2a9666b33a751fd0 (diff) | |
download | itstool-b57dfa4327da4d889dbfc5d26d824482fd7b2f54.tar.gz |
Don't bomb if a locNotePointer returns a string
-rwxr-xr-x | itstool.in | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -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: |