Bonjour je sais que je suis pas dans la bonne cathégorie, mais je n'ai rien trouvé pour Cherrypy ni pour Cheetah.
Voici mon problème, J'essai de créer un site en Pyhton avec la partie web utilisant Cherrypy et faire mon système de template avec Cheetah!
Cherrypy tout marche bien, Cheetah aussi mais lorsque je combine les 2 bah j'ai un probleme!!
en gros Cherrypy a besoin de retourner un String (au format HTML), genre:
simple :)Code:
1
2
3
4
5
6
7 class HelloWorld: def index(self): return ''' <p>Hello world!</p> ''' index.exposed = True
Du cote de Cheetah, il faut créer un template (maTemplate.tmpl), genre:
Du coup du cote Cherrypy, en combinant:Code:
1
2
3
4
5
6
7
8
9 <html> <head> <title>$title</title> </head> <body> maPage </body> </html>
et ca ca ne marche pas :'( quelqu'un a une idée ???Code:
1
2
3
4
5
6
7
8
9 class HelloWorld: def index(self): from Cheetah.Template import Template fichier = 'maTemplate.tmpl' template = Template(file = fichier) template.title = 'toto' return template index.exposed = True
merci