Mercurial > genshi > mirror
changeset 229:58d974683419 trunk
Add support for loading a template from a string to the template engine plugin. Closes #52. Thanks to Alberto for the patch.
author | cmlenz |
---|---|
date | Mon, 11 Sep 2006 09:47:21 +0000 |
parents | a5b38b459cbb |
children | 84168828b074 |
files | markup/plugin.py |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/markup/plugin.py +++ b/markup/plugin.py @@ -54,8 +54,13 @@ self.options = options self.get_extra_vars = extra_vars_func - def load_template(self, templatename): - """Find a template specified in python 'dot' notation.""" + def load_template(self, templatename, template_string=None): + """Find a template specified in python 'dot' notation, or load one from + a string. + """ + if template_string is not None: + return Template(template_string) + divider = templatename.rfind('.') if divider >= 0: package = templatename[:divider]