John Salerno <johnjsal@NOSPA Mgmail.com>:
You don't. Normally you embed only the code, that is absolutely necessary,
e.g. for iterating over a list.
Consider an online shop, that needs to do display a list of articles.
Inside the template, you would iterate over a list of and query attributes
of "Article" object to render the information as HTML. You would _not_
create a database connection, parse search parameters, find matching
articles and create a list of them. That's the job of the controller
inside the web app.
--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
But when you have a templating system that mixes HTML and Python code, how
is this helping to keep things separate?
is this helping to keep things separate?
e.g. for iterating over a list.
Consider an online shop, that needs to do display a list of articles.
Inside the template, you would iterate over a list of and query attributes
of "Article" object to render the information as HTML. You would _not_
create a database connection, parse search parameters, find matching
articles and create a list of them. That's the job of the controller
inside the web app.
--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)