Hello,
is it possible to pass arguments to the derived template, i am getting the
following error
<error>
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] Traceback (most
recent call last):
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] File
"/usr/local/lib/python2.7/dist-packages/web/application.py", line 239, in
proc
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] return
self.handle()
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] File
"/usr/local/lib/python2.7/dist-packages/web/application.py", line 230, in
hand
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] return
self._delegate(fn, self.fvars, args)
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] File
"/usr/local/lib/python2.7/dist-packages/web/application.py", line 420, in
_del
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] return
handle_class(cls)
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] File
"/usr/local/lib/python2.7/dist-packages/web/application.py", line 396, in
hand
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] return
tocall(*args)
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] File
"/var/www/webpy-app/classifier.py", line 35, in GET
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] return
render.todoPathIndex(todos)
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] File
"/usr/local/lib/python2.7/dist-packages/web/template.py", line 1020, in
templa
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] return
self._base(t(*a, **kw))
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] File
"/usr/local/lib/python2.7/dist-packages/web/template.py", line 881, in
__call_
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] return
BaseTemplate.__call__(self, *a, **kw)
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] File
"/usr/local/lib/python2.7/dist-packages/web/template.py", line 808, in
__call_
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] return
self.t(*a, **kw)
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3] TypeError:
__template__() takes no arguments (1 given)
[Sun Aug 18 02:47:48 2013] [error] [client 192.168.1.3]
</error>
Here is my base template
[template file=layout.html]
$def with (content)
<html>
<head>
<title>classifier:$content.title</title>
</head>
<body>
$:content
</body>
</html>
[/template]
and here is my derived template
[template file=todoPathIndex.html]
$def with (todos)
$var title: modify todo path
<p>
Delete/View todopath:
<form method="post" action="todoPath/delete">
<table border=1>
$for todo in todos:
<tr>
<td><input type="radio" name="toDelete" value="$todo.ID"/></td>
<td>$todo.ID</td>
<td>$todo.PATH</td>
</tr>
<input type="submit" value="Delete" />
</form>
</table>
</p>
<p>
<br />
Add path:
<form method="post" action="todoPath/add">
<input type="text" name="title" />
<input type="submit" value="Add" />
</form>
</p>
[/template]
Here are the snippets of the relevant code
<code>
render = web.template.render('/var/www/webpy-app/templates/' ,
base='layout')
...
class todoPathIndex:
def GET(self):
todos = db.select('todoPath')
return render.todoPathIndex(todos)
What am i doing wrong ??
Regards,
Harish Badrinath
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.