【问题标题】:User doesn't have attribute "create_logout_url"?用户没有属性“create_logout_url”?
【发布时间】:2013-10-11 05:10:31
【问题描述】:

我有一个用注销 URL 编写的简单按钮。但是,根据这个错误,“用户”没有创建登录 URL 的功能,当它清楚地显示在 API docs

self.response.write(MAIN_PAGE_HTML.replace('___EMAIL___',user.email()).replace('___LOGOUT_URL___',user.create_logout_url('http://www.s-t-h-c.appspot.com')))

【问题讨论】:

  • 你能显示错误回溯,并显示通往该行的行吗? (我们甚至不知道变量user 中的内容。
  • 应该是 users.create_logout_url()。检查它是“用户”而不是用户。我认为“用户”是定制的。这个问题我不能说太多。

标签: python google-app-engine


【解决方案1】:

create_login_url(..) 不是User 上的函数,而是google.appengine.api.users 包中的standalone function

from google.appengine.api import users

users.create_logout_url(url)

【讨论】:

    猜你喜欢
    • 2018-10-18
    • 1970-01-01
    • 2014-01-10
    • 2018-02-02
    • 2012-01-14
    • 2021-06-29
    • 2013-05-13
    • 2021-06-10
    相关资源
    最近更新 更多