web.py的一个模版问题
<!-- index.html -->
$def with (posts, login_form)
<h1>Blog posts</h1>
$if not cookie().get('username'):
<form action="" method="post">
$:login_form.render()
</form>
$else:
Welcome $cookie().get('username')!<a href="/logout" mce_href="logout">Logout</a>
<ul>
$for post in posts:
<li>
<a href="/view/$post.id" mce_href="view/$post.id">$post.title</a>
on $post.posted_on
$if cookie().get('username'):
<a href="/edit/$post.id" mce_href="edit/$post.id">Edit</a>
<a href="/delete/$post.id" mce_href="delete/$post.id">Del</a>
</li>
$def with (posts, login_form)
<h1>Blog posts</h1>
$if not cookie().get('username'):
<form action="" method="post">
$:login_form.render()
</form>
$else:
Welcome $cookie().get('username')!<a href="/logout" mce_href="logout">Logout</a>
<ul>
$for post in posts:
<li>
<a href="/view/$post.id" mce_href="view/$post.id">$post.title</a>
on $post.posted_on
$if cookie().get('username'):
<a href="/edit/$post.id" mce_href="edit/$post.id">Edit</a>
<a href="/delete/$post.id" mce_href="delete/$post.id">Del</a>
</li>
</ul>
说我在第八行的$else:那里有语法错误,真心看不出来:
<type 'exceptions.SyntaxError'> at /
invalid syntax Template traceback: File 'templates\index.html', line 8 $else: (index.html, line 8)
Python | C:Python27libsite-packageswebtemplate.py in compile_template, line 911 |
---|---|
Web | GET http://127.0.0.1:8080/ |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
还有里面的 mce_href是做什么用的呢?