django保存错误 [英] django save error

查看:98
本文介绍了django保存错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for *** :
   try:
       xx = A(
          a=x,
          b=y
       )
       xx.save()
   except:
     pass

这里是我的问题:一旦xx保存错误,其他人就不会保存成功。
有没有人知道为什么?谢谢!

here is my question: once one of the "xx" saved error, others will not save success. Does any one know why? thanks!

这里是错误消息

Exception
[2011-08-22 14:02:23,879: WARNING/PoolWorker-1] RuntimeError
[2011-08-22 14:02:23,879: WARNING/PoolWorker-1] :
[2011-08-22 14:02:23,879: WARNING/PoolWorker-1] 'generator ignored GeneratorExit'
[2011-08-22 14:02:23,879: WARNING/PoolWorker-1] in
[2011-08-22 14:02:23,880: WARNING/PoolWorker-1] <generator object msg_iter_page at 0x2ec28c0>
[2011-08-22 14:02:23,880: WARNING/PoolWorker-1] ignored


推荐答案

您可以通过以下语句捕获每个异常:

You catch every exception with this statement:

except:
   pass

GeneratorExit只是一个例外。这不应该被抓住。请您只收到例外情况。

GeneratorExit is just an exception. This should not be caught. Please catch only the exceptions, you expect.

这篇关于django保存错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆