# HG changeset patch # User cmlenz # Date 1184403380 0 # Node ID 461d9d0e85a45e1edea0e3b535983ddd8dce93d1 # Parent 53b37e4f29215812c62510cbaac637a365023557 AST transformer needs to also handle the class body. diff --git a/genshi/template/eval.py b/genshi/template/eval.py --- a/genshi/template/eval.py +++ b/genshi/template/eval.py @@ -443,7 +443,7 @@ def visitClass(self, node): return self._clone(node, node.name, [self.visit(x) for x in node.bases], - node.doc, node.code + node.doc, self.visit(node.code) ) def visitFunction(self, node): diff --git a/genshi/template/tests/eval.py b/genshi/template/tests/eval.py --- a/genshi/template/tests/eval.py +++ b/genshi/template/tests/eval.py @@ -457,6 +457,15 @@ suite.execute(data) assert 'plain' in data + def test_class_with_methods(self): + suite = Suite("""class plain(object): + def donothing(): + pass +""") + data = {} + suite.execute(data) + assert 'plain' in data + def test_import(self): suite = Suite("from itertools import ifilter") data = {}