[dbapi] move ProgrammingError into cubicweb module
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 24 Jun 2013 14:55:26 +0200
changeset 9046 6fb3f0106301
parent 9045 5378a738f333
child 9047 c873445fe198
[dbapi] move ProgrammingError into cubicweb module A new ``repoapi`` will be introduced as a replacement for the dbapi. It will need ProgrammingError too. Related to #2503918
__init__.py
dbapi.py
--- a/__init__.py	Mon Jun 17 15:00:41 2013 +0200
+++ b/__init__.py	Mon Jun 24 14:55:26 2013 +0200
@@ -221,3 +221,15 @@
             errors[rname(*key)] = errors.pop(key)
     return ValidationError(getattr(entity, 'eid', entity), errors,
                            substitutions, i18nvalues)
+
+
+# exceptions ##################################################################
+
+class ProgrammingError(Exception): #DatabaseError):
+    """Exception raised for errors that are related to the database's operation
+    and not necessarily under the control of the programmer, e.g. an unexpected
+    disconnect occurs, the data source name is not found, a transaction could
+    not be processed, a memory allocation error occurred during processing,
+    etc.
+    """
+
--- a/dbapi.py	Mon Jun 17 15:00:41 2013 +0200
+++ b/dbapi.py	Mon Jun 24 14:55:26 2013 +0200
@@ -37,8 +37,8 @@
 from logilab.common.decorators import monkeypatch, cachedproperty
 from logilab.common.deprecation import deprecated
 
-from cubicweb import ETYPE_NAME_MAP, AuthenticationError,\
-     cwvreg, cwconfig
+from cubicweb import (ETYPE_NAME_MAP, AuthenticationError, ProgrammingError,
+                      cwvreg, cwconfig)
 from cubicweb.repoapi import get_repository
 from cubicweb.req import RequestSessionBase
 
@@ -391,16 +391,6 @@
 set_log_methods(DBAPIRequest, getLogger('cubicweb.dbapi'))
 
 
-# exceptions ##################################################################
-
-class ProgrammingError(Exception): #DatabaseError):
-    """Exception raised for errors that are related to the database's operation
-    and not necessarily under the control of the programmer, e.g. an unexpected
-    disconnect occurs, the data source name is not found, a transaction could
-    not be processed, a memory allocation error occurred during processing,
-    etc.
-    """
-
 
 # cursor / connection objects ##################################################