turbogears1
Table of Contents
První verze, adresář foto/foto
Soubor controllers.py
from turbogears import controllers, expose, flash # from foto import model import logging log = logging.getLogger("foto.controllers") class Root(controllers.RootController): @expose(template="foto.templates.welcome") def index(self): import time # log.debug("Happy TurboGears Controller Responding For Duty") flash("Your application is now running") return dict(now=time.ctime()) @expose(template="foto.templates.pokus") def pokus(self): import time log.debug("*** Nekdo navstivil fologalerii ***") flash("Fotografie") return dict(current_time=time.ctime())
Soubor template/pokus.kid
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="'master.kid'"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/> <title>Fotografie</title> </head> <body> <div id="sidebar"> <h2>Plovoucí text </h2> Nejaky text <br/> Odkaz na <a href="http://www.turbogears.org">TurboGears website</a> </div> <div class="notice"> <span py:replace="current_time"> tento text bude nahrazen hodnou promenne current_time</span> </div> </body> </html>
Spuštění aplikace
./start-foto.py
turbogears1.txt · Last modified: 2008/04/17 10:16 by 127.0.0.1