From: Steve <unetright.thebas...@xoxy.net>
Date: Sat, 6 Jun 2009 08:39:52 -0700 (PDT)
Local: Sat, Jun 6 2009 11:39 am
Subject: Re: pyTenjin Feature Requests
I forgot to mention two small modifications that I used:
> > How to create your own Template class and convert "@var"
I actually used this instead:
> > into "_context.get('var', None)" automatically? > > def _expand(code): > > """expand '@var' into '_context.get("var", None)'""" > > return re.sub(r"@(\w+)", r"_context.get('\1', None)", code) > > class MyTemplate(tenjin.Template):
> > def add_stmt(self, buf, code):
> > def add_expr(self, buf, code, flag_escape=None):
_expand_match = re.compile(r'@(\w+)')
The first difference is that the match pattern is compiled once
Thanks,
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||