diff options
| -rw-r--r-- | doc/build/changelog.rst | 3 | ||||
| -rw-r--r-- | mako/template.py | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/doc/build/changelog.rst b/doc/build/changelog.rst index 25d63b8..7379da3 100644 --- a/doc/build/changelog.rst +++ b/doc/build/changelog.rst @@ -8,6 +8,9 @@ Changelog .. changelog:: :version: 1.0.4 + Added new method :meth:`.Template.list_defs`. Pull request courtesy + Jonathan Vanasco. + .. changelog:: :version: 1.0.3 :released: Tue Oct 27 2015 diff --git a/mako/template.py b/mako/template.py index 8fd6062..6b34514 100644 --- a/mako/template.py +++ b/mako/template.py @@ -476,9 +476,13 @@ class Template(object): return DefTemplate(self, getattr(self.module, "render_%s" % name)) def list_defs(self): - """returns a list of defs in the template""" + """return a list of defs in the template. + + .. versionadded:: 1.0.4 + + """ return [i[7:] for i in dir(self.module) if i[:7] == 'render_'] - + def _get_def_callable(self, name): return getattr(self.module, "render_%s" % name) |
