Massimo
Massimo
In principle I have no objection in adding this functionality but I
would not like to patch the core files for every template language
that people want to use.
Perhaps there should be a mechanism to allow genshi (and other
template) support via decorators defined in a
gluon.contrib.templates.genshi file.
Or should we consider genshi special? Is there a reason to do it the
proposed way?
Massimo
On Jul 25, 2008, at 12:29 PM, Timbo wrote:
I'm wary of ``enhancements'' like this because I can't see anything
radically new or better, so it's really just a marketing thing to
attract developers who don't want to learn a new templating system or
don't like the current one.
Once you start down this road you begin breaking web2py's greatest
strengths: simplicity, elegance and consistency. These are the reasons
I'm using web2py because it's small, elegant and intellectually
manageable. You can never please everyone -- if you try you end up
pleasing no one. Plus you've now got the all problems of 3rd party
library dependence that Massimo has talked about in the past.
Massimo wrote a really good post touching on these issues:
http://groups.google.com/group/web2py/browse_thread/thread/c090560680b65db2#msg_d7e2e220f03da5b0
Every line of code adds future compatibility constraints and has to be
maintained; every new library has there own set of bugs and every new
feature adds to the web2py learning curve. So lets only add features if
they are genuinely useful, add something new that can't otherwise be
done and are seamlessly integrated into web2py.
Just my opinons though :-)
Cheers, Stuart
Massimo Di Pierro wrote:
> While I look into this.... I would like to hear other people opinions
> about adding something like this.
>
> In principle I have no objection in adding this functionality but I
> would not like to patch the core files for every template language
> that people want to use.
> Perhaps there should be a mechanism to allow genshi (and other
> template) support via decorators defined in a
> gluon.contrib.templates.genshi file.
>
> Or should we consider genshi special? Is there a reason to do it the
> proposed way?
>
> Massimo
[...]
Why is Rails so successful when compared with Django or Pylons? It is
not because of its extensibility but because of its simplicity.
Simplicity means it is easy to learn, easy to maintain, people can
build a culture and a community around it.
web2py has it own template language that very closely mimic the rails
one since it has proven to be successful. It copied from Django the
use of {{ }} instead of <% %> because this allows the use of html
editors.
Timbo has done an execllent job with adding support of the Genshi
templates and his code clearly shows he understands web2py. I suggest
that
Timbo rewrites his code in the form os a render_as_genshi or as a
decorator or both that it can go into a a separate module file and
that it will not need modification of the core web2py code. This
module cannot be part of web2py because it has dependencies (the
Genshi template engine) but I will be happy to post it with
documentation as an AlterEgo page.
Massimo
@render_genshi
def index(): return dict()
or
def index(): return render_genshi(template_filename,dict())
both are acceptable. The second solution is easier and more powerful
(because can be used to build components).
Massimo
Massimo
I am in the final week of completing the manual. I will get back to
you on this asap.
Massimo
I suggest we stick with the current solution. You can already define
> def postprocess(vars,response):
> vars.update(dict(message="There is no spoon"))
> response.flash = 'Howdy!'
> return vars
and pass it to postprocessing in any controller:
response.postprocessing.append(lambda vars: postprocess
(vars,request))
It is better to explicit about what to pass because the probably
postprocessing functions belong to modules more than they belong to
controllers.
As a web2py principle I am against introducing a new convention when
something can already be done.
Massimo
On Jul 31, 2008, at 2:45 PM, Timbo wrote:
There are some plugins I do not want to encourage (those that make
your code work in alternative ways) while there are some I want to
encourage (those that follow strict unwritten specifications,
"enterprise python beans" specifications, or "contrib" as Stuart
called them).
There should be an appliance to manage EPB but first we have to write
specifications. This is an open issue.
I envision a system where a plugin is a tar file (like an app) and
everybody can post them (no centralize repository) and a wizard app
that allows to install a plugin using the url. For example you
published http://www.blacktorne.com/autentication.epb and I want to
give authentication to my app, I just type your url and it will ask
me questions to hook into my app (what's the database? which table
names? etc.)
I am in the middle of finishing the book so we need to postpone this
discussion in a week.
Massimo
Don't know that's the sort of thing you are thinking of or not though.
Cheers, Stuart