[Zope-CVS] CVS: Products/AdaptableStorage/mapper - FieldSchema.py:1.3 MapperEvent.py:1.2 exceptions.py:1.3 public.py:1.2

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


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

Modified Files:
	FieldSchema.py MapperEvent.py exceptions.py public.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/mapper/FieldSchema.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/mapper/FieldSchema.py:1.2	Mon Jan  6 18:17:44 2003
+++ Products/AdaptableStorage/mapper/FieldSchema.py	Thu Jan  9 09:34:02 2003
@@ -24,7 +24,7 @@
             'classification', 'keychain', 'string:list']
 
 
-def addType(t):
+def addFieldType(t):
     """Adds an allowable field type."""
     assert isinstance(t, StringType)
     if t not in ok_types:


=== Products/AdaptableStorage/mapper/MapperEvent.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/mapper/MapperEvent.py:1.1	Tue Dec 31 16:47:46 2002
+++ Products/AdaptableStorage/mapper/MapperEvent.py	Thu Jan  9 09:34:02 2003
@@ -16,7 +16,8 @@
 $Id$
 """
 
-from interfaces.public import IMapperEvent
+from interfaces.public import IMapperEvent, ILoadEvent, IStoreEvent
+
 
 class MapperEvent:
 
@@ -39,4 +40,16 @@
     def makeKeychain(self, name, stored):
         kcg = self.getObjectMapper().getKeychainGenerator()
         return kcg.makeKeychain(self, name, stored)
+
+
+class LoadEvent (MapperEvent):
+    """Object loading event."""
+
+    __implements__ = ILoadEvent
+
+
+class StoreEvent (MapperEvent):
+    """Object storing event."""
+
+    __implements__ = IStoreEvent
 


=== Products/AdaptableStorage/mapper/exceptions.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/mapper/exceptions.py:1.2	Mon Jan  6 18:17:44 2003
+++ Products/AdaptableStorage/mapper/exceptions.py	Thu Jan  9 09:34:02 2003
@@ -25,3 +25,6 @@
 class DeserializationError(MappingError):
     """Error during deserialization"""
 
+class NoStateFoundError(MappingError):
+    """No state is there to load"""
+


=== Products/AdaptableStorage/mapper/public.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/mapper/public.py:1.1	Tue Dec 31 16:47:46 2002
+++ Products/AdaptableStorage/mapper/public.py	Thu Jan  9 09:34:02 2003
@@ -20,10 +20,10 @@
 from exceptions import *
 
 from DeserializationEvent import DeserializationEvent
-from MapperEvent import MapperEvent
+from MapperEvent import MapperEvent, LoadEvent, StoreEvent
 from ObjectGateway import ObjectGateway
 from ObjectMapper import ObjectMapper
 from ObjectSerializer import ObjectSerializer
-from FieldSchema import FieldSchema, RowSchema, RowSequenceSchema
+from FieldSchema import FieldSchema, RowSchema, RowSequenceSchema, addFieldType
 from SerializationEvent import SerializationEvent