#16340: get_or_create should preserve the original traceback. ----------------------------+---------------------------------------------- Reporter: d0ugal | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Database layer (models, ORM) Milestone: | Severity: Normal Version: 1.3 | Triage Stage: Unreviewed Keywords: | Easy pickings: 1 Has patch: 0 | UI/UX: 0 | ----------------------------+---------------------------------------------- (more context in #15117)
get_or_create in django.db.models.query re-raises the last exception as below. This modifies the traceback and the exception should preserve this. {{{ except IntegrityError, e: transaction.savepoint_rollback(sid, using=self.db) try: return self.get(**lookup), False except self.model.DoesNotExist: raise e }}} this can be fixed with {{{ exc_info = sys.exc_info() try: return self.get(**lookup), False except self.model.DoesNotExist: raise exc_info[1], None, exc_info[2] }}} -- Ticket URL: <https://code.djangoproject.com/ticket/16340> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.