【发布时间】:2018-01-30 22:35:22
【问题描述】:
当我尝试从 jinja 模板传递多个参数时出现解析错误:
jinja2.exceptions.TemplateSyntaxError: 预期令牌',',得到':'
@classmethod
def follow_user(cls, followed_email, follower_email):
with CursorFromConnectionFromPool() as cursor:
cursor.execute('INSERT INTO connections(follower_id, followee_id) VALUES (%s, %s)',
(follower_email,followed_email))
@classmethod
def unfollow_user(cls, followed_email, follower_email):
with CursorFromConnectionFromPool() as cursor:
cursor.execute("DELETE from connections WHERE follower_id = '{}' AND followee_id = '{}' ",
(follower_email, followed_email))
{% if is_following %}
<a class="btn btn-danger" href="{{ url_for('user.unfollow_user',followed_email:followed.email,follower_email:follower_email) }}" role="button">Unfollow</a>
{% else %}
<a class="btn btn-success" href="{{url_for('user.follow_user',followed_email:followed.email,follower_email:follower_email) }}" role="button">Follow</a>
{% endif %}
【问题讨论】: