Mercurial > genshi > mirror
comparison genshi/core.py @ 798:5d8ca3f527af stable-0.5.x
Ported [914], [970], and [971] to 0.5.x branch.
author | cmlenz |
---|---|
date | Thu, 15 Jan 2009 23:50:09 +0000 |
parents | ca72e3dc443d |
children |
comparison
equal
deleted
inserted
replaced
797:d418c48587af | 798:5d8ca3f527af |
---|---|
11 # individuals. For the exact contribution history, see the revision | 11 # individuals. For the exact contribution history, see the revision |
12 # history and logs, available at http://genshi.edgewall.org/log/. | 12 # history and logs, available at http://genshi.edgewall.org/log/. |
13 | 13 |
14 """Core classes for markup processing.""" | 14 """Core classes for markup processing.""" |
15 | 15 |
16 try: | |
17 from functools import reduce | |
18 except ImportError: | |
19 pass # builtin in Python <= 2.5 | |
16 from itertools import chain | 20 from itertools import chain |
17 import operator | 21 import operator |
18 | 22 |
19 from genshi.util import plaintext, stripentities, striptags | 23 from genshi.util import plaintext, stripentities, striptags |
20 | 24 |
638 | 642 |
639 def __getitem__(self, name): | 643 def __getitem__(self, name): |
640 return QName(self.uri + u'}' + name) | 644 return QName(self.uri + u'}' + name) |
641 __getattr__ = __getitem__ | 645 __getattr__ = __getitem__ |
642 | 646 |
647 def __hash__(self): | |
648 return hash(self.uri) | |
649 | |
643 def __repr__(self): | 650 def __repr__(self): |
644 return '<Namespace "%s">' % self.uri | 651 return '<Namespace "%s">' % self.uri |
645 | 652 |
646 def __str__(self): | 653 def __str__(self): |
647 return self.uri.encode('utf-8') | 654 return self.uri.encode('utf-8') |