web.py的一个模版问题

发布于 2021-11-23 04:25:47 字数 1869 浏览 721 评论 1

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

</ul>


说我在第八行的$else:那里有语法错误,真心看不出来:

 

<type 'exceptions.SyntaxError'> at /

invalid syntax Template traceback: File 'templates\index.html', line 8 $else: (index.html, line 8)

PythonC:Python27libsite-packageswebtemplate.py in compile_template, line 911
WebGET http://127.0.0.1:8080/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哑剧 2021-11-23 04:52:49

还有里面的 mce_href是做什么用的呢?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文