Mercurial > genshi > genshi-test
diff markup/core.py @ 73:b0fd16111f2e
Some more performance tweaks.
author | cmlenz |
---|---|
date | Wed, 12 Jul 2006 18:47:39 +0000 |
parents | e9a3930f8823 |
children | f1aa49c759b2 |
line wrap: on
line diff
--- a/markup/core.py +++ b/markup/core.py @@ -297,14 +297,13 @@ as is. Escaping quotes is generally only required for strings that are to be used in attribute values. """ - if isinstance(text, cls): + if not text: + return cls() + if type(text) is cls: return text - text = unicode(text) - if not text or isinstance(text, cls): - return cls() - text = text.replace('&', '&') \ - .replace('<', '<') \ - .replace('>', '>') + text = unicode(text).replace('&', '&') \ + .replace('<', '<') \ + .replace('>', '>') if quotes: text = text.replace('"', '"') return cls(text) @@ -397,7 +396,6 @@ def __getitem__(self, name): return QName(self.uri + u'}' + name) - __getattr__ = __getitem__ def __repr__(self):