#15901: Django should wrap all PEP 249 exceptions in db.utils
-------------------------------------+-------------------------------------
     Reporter:  xiaket               |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by jamesh):

 If you don't mind special casing for the broken versions of Python 3.x,
 one option would be to use the `__bases__` version of the patch on those
 versions.  The ugly bits could easily be wrapped up in a class method:

     {{{
 class DatabaseError(Exception):
     @classmethod
     def register(cls, other):
         if not issubclass(other, cls):
             other.__bases__ += (cls,)
 }}}

 This would allow the use of the same code in the backends as gcbirzan's
 patch, whether the exception is defined as an abc or not.  When you decide
 to drop support for the broken versions of Python, the compatibility code
 could be removed.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/15901#comment:24>
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to