A simple Jinja filter: renderstring

I wrote this filter for Weblog:

def do_renderstring():
    def wrapped(env, context, value):
        Render the passed string. It is similar to the tag rendertemplate,
        except it uses the passed string as the template.
    The template 'Hello {{ string_template|renderstring }}!';
    Called with the following context:
        dict(string_template='{{ foo }} world',
    Renders to:
    'Hello crazy world!'
    if value:
        return env.from_string(value).render(context.to_dict())
return wrapped

env.filters['renderstring'] = do_renderstring

Where env is a Jinja Environment object.

The code is in the public domain ;-)