web2py —格式需要映射吗?
我已经弄清楚如何让我的网站在用户登录时说“你好,约翰”,但我不知道如何让它不返回错误:
<type 'exceptions.TypeError'>(format requires a mapping)
关于此代码:
return dict(listings=listings, hello='hello %(first_name)s' % auth.user)
I have figured out how to get my site to say 'Hello, John' when the user is logged in, but I can't figure out how to have it not return the error:
<type 'exceptions.TypeError'>(format requires a mapping)
In regards to this code:
return dict(listings=listings, hello='hello %(first_name)s' % auth.user)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许你的 auth.user 是
None
这是一个快速检查,它会抛出该异常
你可以尝试这样的事情
Perhaps your auth.user is
None
here is a quick check that it would throw that exception
You could try somthing like this