Permalink
Browse files

More fixes from ttkit

  • Loading branch information...
1 parent b4e1ec9 commit 86856c16f16333395b7a8b2ca70784e7496c1c94 @nijel nijel committed May 9, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 ttkit/aresource.py
View
@@ -238,7 +238,10 @@ def settarget(self, target):
target = target.replace('<', '&lt;')
newstring = etree.fromstring('<string>%s</string>' % target)
# Update text
- self.xmlelement.text = self.escape(newstring.text)
+ if newstring.text is None:
+ self.xmlelement.text = ''
+ else:
+ self.xmlelement.text = newstring.text
# Remove old elements
for x in self.xmlelement.iterchildren():
self.xmlelement.remove(x)
@@ -252,10 +255,10 @@ def settarget(self, target):
def gettarget(self, lang=None):
# Grab inner text
- target = (self.xmlelement.text or u'')
+ target = self.unescape(self.xmlelement.text or u'')
# Include markup as well
target += u''.join([data.forceunicode(etree.tostring(child, encoding='utf-8')) for child in self.xmlelement.iterchildren()])
- return self.unescape(target)
+ return target
target = property(gettarget, settarget)

0 comments on commit 86856c1

Please sign in to comment.