librelist archives

« back to archive

Chameleon on Flask

Chameleon on Flask

From:
Koray Atlay
Date:
2010-11-28 @ 08:38
Hello,

I am studying Computer engineering, and for my semester project i was given
to add chameleon support to Flask by my lecturer. I am very new about this
subject,so I researched and did some reading and learning about
genshi,jinja2 and chameleon. About their applicatios, their templating
languages and did some exercises. And now i want to start adding chameleon
support to Flask, but i kinda dont know where and how to start that
procedure. I read the extension wizard, but my main question is how can i
start converting and changing Flask's templating modules and methods in a
way that will use Chameleon as a templating engine?

Where can i start my work from?  Thank you for your time and answers.

Best Regards,

Koray

Re: [flask] Chameleon on Flask

From:
Simon Sapin
Date:
2010-11-28 @ 08:51
Le 28/11/2010 17:38, Koray Atlay a écrit :
> And now i want to start adding chameleon support to Flask, but i kinda 
> dont know where and how to start that procedure. I read the extension 
> wizard, but my main question is how can i start converting and 
> changing Flask's templating modules and methods in a way that will use 
> Chameleon as a templating engine?

Hi,

Have a look at the Flask-Genshi and how it’s done.
http://packages.python.org/Flask-Genshi/
https://github.com/dag/flask-genshi/blob/master/flaskext/genshi.py

> how can i start converting and changing Flask's templating modules and 
> methods in a way that will use Chameleon as a templating engine?

Monkey-patching the flask.render_* functions to give them a completly 
different behaviour is probably a bad idea. Instead, just provide yours 
in your module and one can just choose which to import.

Regards,
-- 
Simon Sapin