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())
<!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>