Am 28.07.2011 21:56 schrieb Alessandro Molina:
I just did a few changes to render.py, decorators.py and master.html
and I'm now able to render pages in both xhtml and
application/xhtml+xml by simply specifying it inside the expose
decorator like:

@expose('app.templates.index') ->  outputs xhtml with content_type text/html
@expose('app.templates.index', content_type='application/xhtml+xml')
->  outputs xml with right content type

Also changing charset in response works correctly.
Probably is fine to push this as is as it might have his own life.

Yes, that would be nice to have.

Btw, we have a similar problem with the doctype. As far as I see, in TG2
you cannot change it or have it automatically adapt to the content type
(e.g. HTML, XMTML1, HTML5).

Yes, this is indeed a more difficult issue to solve.
Should we define h.doctype() and substitute the line in master.html with that?
Currently there isn't any easier solution that I'm able to think of.

Genshi actually inserts the proper doctype if you pass it along with the output method to the render method (e.g. doctype='html').

The only problem is that Pylon's render_genshi function does not pass the doctype parameter. I had already reported this as Pylons ticket 613, but it was never fixed. So the best solution would be to just inline and improve Pylon's templating.render_genshi funtion into TG's render.render_genshi function.

The doctype could then set from in render_genshi according to the 'templating.genshi.doctype' setting, with a suitable default derived from the output method.

-- Christoph

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

Reply via email to