newbie question : first template
Hello, I'm just trying Nevow and I follow the BIG example page. But I'm blocked in the juste first test : print a string with the template. Here my code : ------------------------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" xmlns:nevow="http://nevow.com/ns/nevow/0.1"> <head> <title>title</title> </head> <body> <h3>very simple test</h3> Hello nevow... Could you see my <span nevow:data="test" /> ? </body> </html> ------------------------------------ # -*- python -*- # -*- coding: utf-8 -*- from twisted.application import service, internet from nevow import appserver, rend, loaders class Page(rend.Page): addSlash=True docFactory = loaders.xmlfile('./htmlpage_first.html') def data_test( self, context, data ) : return "pattern" application = service.Application( 'appli' ) website = appserver.NevowSite( resource=Page() ) webserver = internet.TCPServer( 8080, website ) webserver.setServiceParent( application ) ----------------------------------------------------- It must be something stupid but I could'nt find it ! Thanks in advance, -- Sylvain de Tilly
Quoting Sylvain de Tilly <sylvain.detilly@adelux.fr>:
Hello,
I'm just trying Nevow and I follow the BIG example page. But I'm blocked in the juste first test : print a string with the template. Here my code : [snip] Hello nevow... Could you see my <span nevow:data="test" /> ? </body> </html>
[snip] class Page(rend.Page): addSlash=True
docFactory = loaders.xmlfile('./htmlpage_first.html')
def data_test( self, context, data ) : return "pattern"
Replace the <span nevow:data="test" /> by <span nevow:data="test" nevow:render="data" />. Some useful informations : http://srid.bsdnerds.org/hacking/nevowdoc/ (look at XML templates). -- Thomas
Le vendredi 01 avril 2005 à 17:26 +0200, Thomas HERVE a écrit :
Quoting Sylvain de Tilly <sylvain.detilly@adelux.fr>: Replace the <span nevow:data="test" /> by <span nevow:data="test" nevow:render="data" />.
It runs well !
Some useful informations : http://srid.bsdnerds.org/hacking/nevowdoc/ (look at XML templates).
Thanks for the link, I did'nt have it. I could studie a beat more about Nevow... --
participants (2)
-
Sylvain de Tilly
-
Thomas HERVE