google-code-export / django-pyodbc

Automatically exported from code.google.com/p/django-pyodbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by yi.codep...@gmail.com on 1 Dec 2010 at 7:34

GoogleCodeExporter commented 9 years ago

Original comment by vcc.ch...@gmail.com on 24 Mar 2011 at 4:52