commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r6280 - in trunk/gnue-common/src/datasources: . drivers/Base


From: johannes
Subject: r6280 - in trunk/gnue-common/src/datasources: . drivers/Base
Date: Tue, 14 Sep 2004 09:07:55 -0500 (CDT)

Author: johannes
Date: 2004-09-14 09:07:55 -0500 (Tue, 14 Sep 2004)
New Revision: 6280

Modified:
   trunk/gnue-common/src/datasources/Exceptions.py
   trunk/gnue-common/src/datasources/drivers/Base/DataObject.py
Log:
*) Changed some exception groups
*) case of masterlink-fields is set using the connections identifier () 
function which now can differ per driver


Modified: trunk/gnue-common/src/datasources/Exceptions.py
===================================================================
--- trunk/gnue-common/src/datasources/Exceptions.py     2004-09-14 13:47:28 UTC 
(rev 6279)
+++ trunk/gnue-common/src/datasources/Exceptions.py     2004-09-14 14:07:55 UTC 
(rev 6280)
@@ -28,28 +28,30 @@
 # NOTES:
 #
 
+from gnue.common.apps import errors
+
 class Error(gException):
   # Base exception
   pass
 
-class LoginError(Error):
+class LoginError (errors.UserError):
   # Raised when invalid login user/pass was provided
   # Client should attempt to get better information and
   # try again
   pass
 
-class ConnectError(Error):
+class ConnectError(errors.AdminError):
   # Raised when connection data is invalid (e.g., host not found, etc).
   # Client should probably not attempt to relogin.  Exit gracefully
   # with a reason.
   pass
 
-class ProviderNotSupportedError(Error):
+class ProviderNotSupportedError(errors.AdminError):
   # Raised when a datasource type is requested that the dbdriver
   # does not support (e.g., not all dbdrivers support raw sql mode.)
   pass
 
-class ObjectTypeNotAvailableError(Error):
+class ObjectTypeNotAvailableError(errors.AdminError):
   # Raised when a datasource type is requested that the dbdriver
   # does not support (e.g., not all dbdrivers support raw sql mode.)
   pass
@@ -58,7 +60,7 @@
   # Raised when an attempt is made to update a read-only data object.
   pass
 
-class MasterDetailFieldMismatch(Error):
+class MasterDetailFieldMismatch(errors.ApplicationError):
   # Raised when a the number of master fields doesn't match the
   # number of detail fields. (e.g., masterlink="id,subid"
   # and detaillink="id" would be a problem; must be 1:1)
@@ -68,7 +70,7 @@
   # Generic error reading from the database connection
   pass
 
-class DataTypeNotAvailable(Error):
+class DataTypeNotAvailable(errors.ApplicationError):
   # Raised when a datatype is not supported by an database
   # during writing a schema definition to the database
   pass
@@ -78,9 +80,9 @@
   # writing Schema to datasource
   pass
 
-class InvalidDatasourceDefintion(Error):
+class InvalidDatasourceDefintion(errors.ApplicationError):
   # Raised when a <datasource> definition is
   # incomplete or otherwise doesn't make sense
   # (e.g., a <datasource type="sql"> without a
   # <sql> section.
-  pass
\ No newline at end of file
+  pass

Modified: trunk/gnue-common/src/datasources/drivers/Base/DataObject.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/DataObject.py        
2004-09-14 13:47:28 UTC (rev 6279)
+++ trunk/gnue-common/src/datasources/drivers/Base/DataObject.py        
2004-09-14 14:07:55 UTC (rev 6280)
@@ -124,19 +124,14 @@
     GDebug.printMesg (1,"Adding a master/detail relationship to DataObject")
     dataObject._masterObject = self
 
-    dataObject._masterfields = string.split ( \
-        hasattr (dataObject, 'masterlink') and dataObject.masterlink or "", 
',')
+    dataObject._masterfields = string.split (  \
+        hasattr (dataObject, 'masterlink') and \
+          self._connection.identifier (dataObject.masterlink) or "", ',')
 
-    dataObject._detailfields = string.split ( \
-        hasattr (dataObject, 'detaillink') and dataObject.detaillink or "", 
',')
+    dataObject._detailfields = string.split (  \
+        hasattr (dataObject, 'detaillink') and \
+          self._connection.identifier (dataObject.detaillink) or "", ',')
 
-    # NOTE: since the following code will NOT support case-sensitive fields
-    # we have to look who's screaming afterwards ... :)
-    #dataObject._masterfields = string.split(hasattr(dataObject,'masterlink') 
and \
-                                 #string.lower(dataObject.masterlink) or "", 
',')
-    #dataObject._detailfields = string.split(hasattr(dataObject,'detaillink') 
and \
-                                 #string.lower(dataObject.detaillink) or "", 
',')
-
     if len(dataObject._masterfields) != len(dataObject._detailfields):
       tmsg = u_("master=%s; detail=%s") % (dataObject._masterfields, 
dataObject._detailfields)
       raise Exceptions.MasterDetailFieldMismatch, tmsg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]