[Zope-CVS] CVS: Products/AdaptableStorage/gateway_sql - SQLClassification.py:1.5 SQLGatewayBase.py:1.2 SQLUserList.py:1.3

Shane Hathaway shane@zope.com
Thu, 9 Jan 2003 09:34:33 -0500


Update of /cvs-repository/Products/AdaptableStorage/gateway_sql
In directory cvs.zope.org:/tmp/cvs-serv19323/gateway_sql

Modified Files:
	SQLClassification.py SQLGatewayBase.py SQLUserList.py 
Log Message:
- Added LoadEvent and StoreEvent, which currently serve only to
clarify the code.

- Added tests of conflict detection.

- Added NoStateFoundError.  Classification gateways now raise
NoStateFoundError at the right times so it's possible to detect
attempts to overwrite state with new objects

- Made it easier for a SQL gateway to use multiple tables by adding a
setupTables() method to SQLGatewayBase

- Made FieldSchema.addFieldType public.



=== Products/AdaptableStorage/gateway_sql/SQLClassification.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/gateway_sql/SQLClassification.py:1.4	Tue Dec 31 16:47:45 2002
+++ Products/AdaptableStorage/gateway_sql/SQLClassification.py	Thu Jan  9 09:33:59 2003
@@ -16,7 +16,7 @@
 $Id$
 """
 
-from mapper_public import IGateway, FieldSchema
+from mapper_public import IGateway, FieldSchema, NoStateFoundError
 
 from SQLGatewayBase import SQLGatewayBase
 
@@ -63,7 +63,7 @@
             if rec[1]:
                 classification['class_name'] = rec[1]
         else:
-            rec = ()
+            raise NoStateFoundError(key)
         return classification, rec
 
     def store(self, event, classification):


=== Products/AdaptableStorage/gateway_sql/SQLGatewayBase.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/gateway_sql/SQLGatewayBase.py:1.1	Mon Dec 23 23:29:32 2002
+++ Products/AdaptableStorage/gateway_sql/SQLGatewayBase.py	Thu Jan  9 09:33:59 2003
@@ -25,11 +25,14 @@
 
     def __init__(self, conn):
         self.conn = conn
-        self.table = conn.prefix + '_' + self.table_base_name
+        self.setupTableNames()
         if conn.isConnected():
             self.setupTables()
         else:
             conn.addConnectCallback(self.setupTables)
+
+    def setupTableNames(self):
+        self.table = self.conn.prefix + '_' + self.table_base_name
 
     def setupTables(self):
         conn = self.conn


=== Products/AdaptableStorage/gateway_sql/SQLUserList.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/gateway_sql/SQLUserList.py:1.2	Tue Jan  7 10:14:24 2003
+++ Products/AdaptableStorage/gateway_sql/SQLUserList.py	Thu Jan  9 09:33:59 2003
@@ -92,10 +92,10 @@
     clear_domains_sql = 'DELETE FROM %(domains_table)s'
 
 
-    def __init__(self, conn):
-        self.roles_table = conn.prefix + '_user_roles'
-        self.domains_table = conn.prefix + '_user_domains'
-        SQLGatewayBase.__init__(self, conn)
+    def setupTableNames(self):
+        SQLGatewayBase.setupTableNames(self)
+        self.roles_table = self.conn.prefix + '_user_roles'
+        self.domains_table = self.conn.prefix + '_user_domains'
 
     def setupTables(self):
         conn = self.conn