Export to GitHub

django-pyodbc - issue #96

backend should cache pyodbc.IntegrityError and raise django.db.utils.IntegrityError instead.


Posted on Dec 1, 2010 by Massive Dog

What steps will reproduce the problem? 1.

create a model with unique constraint.

class Test(models.Model): name = models.CharField(max_length=100) class Meta: unique = 'name'

2.

insert two row with same name, try to ignore IntegrityError

from django.db import IntegrityError try: Test(name='test').save() Test(name='test').save() except IntegrityError, e: pass

What is the expected output? What do you see instead?

It should not raise IntegrityError since we ignored it, but it still raise IntegrityError, because pyodbc.IntegrityError is not the same exception as django.db.utils.IntegrityError.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Apologize for my poor english.

Comment #1

Posted on Mar 24, 2011 by Swift Panda

(No comment was entered for this change.)

Status: Accepted

Labels:
Type-Defect Priority-Medium