Issue 65 in django-jython: Incorrect type for IntegrityError after upgrading while testing with django-1.2 and django-jython hg

1 view
Skip to first unread message

django...@googlecode.com

unread,
Aug 13, 2011, 3:47:41 PM8/13/11
to django-j...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 65 by car...@barrobes.com: Incorrect type for IntegrityError
after upgrading while testing with django-1.2 and django-jython hg
http://code.google.com/p/django-jython/issues/detail?id=65

The issue was detected with django-jython 1.3.0b1, jython 2.5.2 and django
1.2, on Ubuntu.

One test in one of my apps which previously passed (django and doj
1.1.1, jython 2.5.1 or 2.5.2rc2) was failing due to an IntegrityError
not being caught. My code looks like:

from django.db import IntegrityError
...

try:
inst.save()
return inst
except IntegrityError:
return rc.DUPLICATE_ENTRY

For debugging purposes I changed the except clause and checked the
type of the exception being thrown and it turns out to be
zxJDBC.IntegrityError instead of django.db.IntegrityError. Django
doesn't seem to recognize that IntegrityError and is not able to wrap
it in its own IntegrityError class.

I'm using the mysql backend, my settings file says:

DATABASES = {
'default': {
'ENGINE': 'doj.backends.zxjdbc.mysql',
etc...
}
}

Any ideas? Is this a bug in the doj backend(s)?

--- WORKAROUND ---
As a workaround I had to use an additional import:

from com.ziclix.python.sql.zxJDBC import IntegrityError as
zxIntegrityError

And modify the try to look like:

try:
inst.save()
return inst
except (IntegrityError, zxIntegrityError):
return rc.DUPLICATE_ENTRY


django...@googlecode.com

unread,
Sep 20, 2011, 7:46:57 AM9/20/11
to django-j...@googlegroups.com
Updates:
Owner: juneau001

Comment #1 on issue 65 by juneau001: Incorrect type for IntegrityError

after upgrading while testing with django-1.2 and django-jython hg
http://code.google.com/p/django-jython/issues/detail?id=65

I will look into this issue...not sure if it is specific to DoJ without
investigating further.

Thanks


django...@googlecode.com

unread,
Nov 16, 2011, 5:04:35 PM11/16/11
to django-j...@googlegroups.com
Updates:
Status: Started

Comment #2 on issue 65 by juneau001: Incorrect type for IntegrityError

after upgrading while testing with django-1.2 and django-jython hg
http://code.google.com/p/django-jython/issues/detail?id=65

To clarify: Did you make the changes described in WORKAROUND in your
Django project code, or within the zxJDBC code base? If you made them
within your Django-specific code, then I do not believe that this is an
issue as Django-Jython uses zxJDBC rather than django.db code.

django...@googlecode.com

unread,
Aug 10, 2014, 4:22:29 AM8/10/14
to django-j...@googlegroups.com
Updates:
Status: Invalid

Comment #3 on issue 65 by andr...@st0cker.at: Incorrect type for
IntegrityError after upgrading while testing with django-1.2 and
django-jython hg
http://code.google.com/p/django-jython/issues/detail?id=65

(No comment was entered for this change.)

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages