Mercurial > genshi > mirror
comparison genshi/template/eval.py @ 733:43147cbc9ea3 trunk
Update to r855 for Python 2.3 support. Fixes #221 (hopefully).
author | athomas |
---|---|
date | Wed, 04 Jun 2008 05:01:16 +0000 |
parents | 01bdf155db95 |
children | a1e8b24bc1bb |
comparison
equal
deleted
inserted
replaced
732:8825ac5014b1 | 733:43147cbc9ea3 |
---|---|
33 'Undefined', 'UndefinedError'] | 33 'Undefined', 'UndefinedError'] |
34 __docformat__ = 'restructuredtext en' | 34 __docformat__ = 'restructuredtext en' |
35 | 35 |
36 # Check for a Python 2.4 bug in the eval loop | 36 # Check for a Python 2.4 bug in the eval loop |
37 try: | 37 try: |
38 class _FakeMapping(object): | 38 class _FakeMapping(dict): |
39 __getitem__ = __setitem__ = lambda *a: None | 39 __getitem__ = __setitem__ = lambda *a: None |
40 exec 'from sys import *' in {}, _FakeMapping() | 40 exec 'from sys import *' in {}, _FakeMapping() |
41 except SystemError: | 41 except SystemError: |
42 has_star_import_bug = True | 42 has_star_import_bug = True |
43 else: | 43 else: |
51 module = __import__(modname, None, None, ['__all__']) | 51 module = __import__(modname, None, None, ['__all__']) |
52 if hasattr(module, '__all__'): | 52 if hasattr(module, '__all__'): |
53 members = module.__all__ | 53 members = module.__all__ |
54 else: | 54 else: |
55 members = [x for x in module.__dict__ if not x.startswith('_')] | 55 members = [x for x in module.__dict__ if not x.startswith('_')] |
56 mapping.update((name, getattr(module, name)) for name in members) | 56 mapping.update([(name, getattr(module, name)) for name in members]) |
57 | 57 |
58 | 58 |
59 class Code(object): | 59 class Code(object): |
60 """Abstract base class for the `Expression` and `Suite` classes.""" | 60 """Abstract base class for the `Expression` and `Suite` classes.""" |
61 __slots__ = ['source', 'code', 'ast', '_globals'] | 61 __slots__ = ['source', 'code', 'ast', '_globals'] |