Twistar ORM刷新功能
也许我不明白,但我无法更新对象。过程如下:
- 我执行 SELECT (
find()
),获取对象。 - 更改此对象的属性中的某些属性
- 运行刷新。
然后我收到以下错误:
exceptions.AttributeError: 'list' object has no attribute 'keys'
即使当我尝试在对象上调用刷新而不更改其属性时,我也会收到相同的错误。
Maybe I did not understand, but I can not update the object. The procedure is as follows:
- I do SELECT (
find()
), get the object. - Change some properties in the properties of this object
- Run the refresh.
Then I get the following error:
exceptions.AttributeError: 'list' object has no attribute 'keys'
Even when I try to call the refresh on object without changing its properties, I get the same error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有代码,就不可能有人提供有用的答案。明显的响应是您正在
list
上查找keys
属性,而列表没有该属性。不过,通过阅读异常,您应该已经学到了很多东西。回溯将告诉您异常发生的位置(以及当时的调用堆栈)。您可以使用它来查找损坏的代码,并了解其损坏的上下文。您描述的“过程”对于这个级别的错误并不重要 - 您只是错误地使用了一个对象(可能将列表视为字典)并且需要修复它。Without code, it's not likely anyone will provide a useful answer. The obvious response is that you're looking up the
keys
attribute on alist
, and lists do not have that attribute. You should have learned that much by reading the exception, though. The traceback will tell you where the exception occurred (and the call stack at the time). You can use that to find the broken code, and learn the context in which it is broken. The "procedure" you describe doesn't really matter for bugs at this level - you're simply using an object incorrectly (probably treating a list as though it were a dict) and need to fix that.