using wVista and python 2.5 and latest web.py
running:
$def with (name)
$if name:
I just wanted to say <em>hello</em> to $name.
$else:
<em>Hello</em>, world!
import web
render = web.template.render('templates/')
urls = (
'/', 'index')
##urls = (
## 'perspage', 'perspage')
class index:
def GET(self):
name = 'Bob'
print render.index(name)
class perspage:
def GET(self):
print "This is your superpersonal page"
class add:
def POST(self):
i = web.input()
n = web.insert('todo', title=i.title)
web.seeother('/')
web.webapi.internalerror = web.debugerror
if __name__ == "__main__": web.run(urls, globals())
results in:
Traceback (most recent call last):
File "C:\Python25\lib\site-packages\web\webapi.py", line 312, in
wsgifunc
result = func()
File "C:\Python25\lib\site-packages\web\request.py", line 131, in
<lambda>
func = lambda: handle(inp, fvars)
File "C:\Python25\lib\site-packages\web\request.py", line 61, in
handle
return tocall(*([x and urllib.unquote(x) for x in args] + fna))
File "C:/Python25/myPrograms/webapps/webexp2.py", line 14, in GET
print render.index(name)
File "C:\Python25\lib\site-packages\web\template.py", line 793, in
__getattr__
return self._do(p)
File "C:\Python25\lib\site-packages\web\template.py", line 780, in
_do
raise AttributeError, 'no template named ' + name
AttributeError: no template named index
127.0.0.1:51056 - - [24/Apr/2008 22:43:14] "HTTP/1.1 GET /" - 200 OK