I dislike django-like templating languages.

I can't sit down and write a single simple django app without the need to
make a templatetag whose whole purpose is to format the data so I can use
djangos other broken tag models to display this data.

Django has the arugment "well our designers arn't programmers so we cant
trust them to use python in the templates". Really? Seriously? I have yet to
come across a django developer that doesn't write his own views one way or
another. He might hire a web designer to make a site, but he still goes in
afterwords and hacks the design into his templating language. And even then
that web designer has their own knowledge of django.

/rant off

the template language is one of the most divine gifts that web2py has given
us.

-Thadeus




On Wed, Jan 27, 2010 at 9:36 AM, Timothy Farrell <tfarr...@swgen.com> wrote:

>  IIRC, response._caller acts like a function decorator.  So it takes a
> function and returns a function.  I used to use Genshi like this:
>
> def renderGenshi(func):
>     def _render():
>         output = func()
>         if not isinstance(dict, output):
>             return output
>         else:
>             # real Genshi render code goes here
>             return Genshi.render(response._view, output)
>     return _render
>
> response._caller = renderGenshi
>
> Naturally it was more complicated than that, but you get the idea.
>
> That said, make sure Jinja2 is really what you want.  I thought I liked it
> until I learned that its context is immutable.  (This means you can't set
> response.title in a template and expect that change to propagate to an
> included or extended template file.  This was a deal-breaker for me.)
>
> In case you're curious, I switched off of Genshi back to web2py templates
> because Genshi only works on normal cPython platforms.  It blows up on
> Jython or AIX Python.
>
> -tim
>
>
> On 1/26/2010 9:05 PM, Thadeus Burgess wrote:
>
> Its going to be your best bet in using a different templating language. YOu
> will have to make sure to only parse your HTML requests and not
> json/download etc.
>
> Basically, response._caller is a function, that returns a string which is
> the html.
>
> So you would instead of response.render(d) you would do jinja2.render(d)
> where d is the dict returned from the action, you will of course have to
> tell jinja where to find templates and which template to render based on
> action
>
> jinja.render(d, '/applications/init/views/' + request.action+'.html')
>
> -Thadeus
>
>
>
>
> On Tue, Jan 26, 2010 at 8:24 PM, Alexandre <airm...@gmail.com> wrote:
>
>> Hi,
>>
>>  I want to replace web2py's template engine with Jinja 
>> 2<http://jinja.pocoo.org/2/>,
>> anyone has some experience doing something similar? I'm trying to assign
>> response._caller with a custom function, but I'm not having much success, is
>> that the right way?
>>
>>  Thanks,
>> Alexandre Rosenfeld
>>
>> Eng Comp 06 - USP São Carlos
>> FoG - http://fog.icmc.usp.br
>> IM Team - AIESEC
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to