librelist archives

« back to archive

add new test function jinja

add new test function jinja

From:
Denis Chumachenko
Date:
2011-03-04 @ 10:43
Hi all ,
I try add new test function for jinja

from jinja2 import tests
tests.TESTS['ip'] = checks.is_ip
app.jinja_options=tests.TESTS
app.create_jinja_environment()
app.run()

Traceback (most recent call last):
   File "__init__.py", line 41, in <module>
     app.create_jinja_environment()
   File 
"/usr/local/lib/python2.6/dist-packages/Flask-0.6.1-py2.6.egg/flask/app.py", 
line 321, in create_jinja_environment
     return Environment(loader=_DispatchingJinjaLoader(self), **options)
TypeError: __init__() got an unexpected keyword argument 'upper'


please tell me how to submit a test function

Re: [flask] add new test function jinja

From:
Armin Ronacher
Date:
2011-03-04 @ 11:22
Hi,

On 3/4/11 11:43 AM, Denis Chumachenko wrote:
> Hi all ,
> I try add new test function for jinja

app = Flask(__name__)
app.jinja_env.tests['ip'] = checks.is_ip


Regards,
Armin

Re: [flask] add new test function jinja

From:
Denis Chumachenko
Date:
2011-03-04 @ 11:47
thanks

04.03.2011 14:22, Armin Ronacher пишет:
> app.jinja_env.tests['ip'] = checks.is_ip