how to use html5 renderer

28 views
Skip to first unread message

jerry_gzy

unread,
May 17, 2012, 9:33:15 AM5/17/12
to nagare...@googlegroups.com
I was play with the html portlet example, an tried a html video tag but got this

Your browser does not support the video tag.

so I am wondering how can I use nagare.namespaces.xhtml5.Renderer() for the render(self, h, comp, *args) function?



apoirier

unread,
May 18, 2012, 9:22:20 AM5/18/12
to Nagare users
To globally set a xhtml5 renderer in your application, create a
`nagare.wsgi.WSGIApp` subclass and set its `renderer_factory`
attribute to `nagare.namespaces.xhtml5.Renderer`.

For example, in the `app.py` file previously generated by a `nagare-
admin create-app` command, change the last line:

app = <<Root Component>>

by

from nagare import component, wsgi
from nagare.namespaces import xhtml5

class WSGIApp(wsgi.WSGIApp):
renderer_factory = xhtml5.Renderer

def component_factory():
return component.Component(<<Root Component>>())

app = WSGIApp(component_factory)


A `xhtml5.Renderer()` will then be passed to all the views of your
components and a correct xhtml5 DOCTYPE will be automatically inserted
in each generated page.
Reply all
Reply to author
Forward
0 new messages