[Zope-CVS] CVS: Products/Ape/lib/apelib/core - events.py:1.10
interfaces.py:1.15 io.py:1.12
Shane Hathaway
shane at zope.com
Fri Mar 26 11:08:31 EST 2004
Update of /cvs-repository/Products/Ape/lib/apelib/core
In directory cvs.zope.org:/tmp/cvs-serv26608/lib/apelib/core
Modified Files:
events.py interfaces.py io.py
Log Message:
All mapper events now have access to the classification.
Especially useful for debugging.
=== Products/Ape/lib/apelib/core/events.py 1.9 => 1.10 ===
--- Products/Ape/lib/apelib/core/events.py:1.9 Sat Mar 20 01:34:22 2004
+++ Products/Ape/lib/apelib/core/events.py Fri Mar 26 11:07:59 2004
@@ -39,22 +39,22 @@
conf = None
mapper = None
oid = ""
+ classification = None
- def __init__(self, conf, mapper, oid):
+ def __init__(self, conf, mapper, oid, classification):
self.conf = conf
self.mapper = mapper
self.oid = oid
+ self.classification = classification
class GatewayEvent (MapperEvent):
__implements__ = interfaces.IGatewayEvent
connections = None
- classification = None
- def __init__(self, conf, mapper, oid, connections, classification):
- MapperEvent.__init__(self, conf, mapper, oid)
+ def __init__(self, conf, mapper, oid, classification, connections):
+ MapperEvent.__init__(self, conf, mapper, oid, classification)
self.connections = connections
- self.classification = classification
class LoadEvent (GatewayEvent):
@@ -63,7 +63,7 @@
__implements__ = interfaces.ILoadEvent
def classify(self, oid):
- sub_event = LoadEvent(self.conf, None, oid, self.connections, None)
+ sub_event = LoadEvent(self.conf, None, oid, None, self.connections)
return self.conf.classifier.classify_state(sub_event)
@@ -73,9 +73,9 @@
__implements__ = interfaces.IStoreEvent
is_new = False
- def __init__(self, conf, mapper, oid, connections, classification, is_new):
+ def __init__(self, conf, mapper, oid, classification, connections, is_new):
GatewayEvent.__init__(
- self, conf, mapper, oid, connections, classification)
+ self, conf, mapper, oid, classification, connections)
self.is_new = is_new
@@ -87,8 +87,8 @@
upos = None
external = None
- def __init__(self, conf, mapper, oid, obj_db, obj):
- MapperEvent.__init__(self, conf, mapper, oid)
+ def __init__(self, conf, mapper, oid, classification, obj_db, obj):
+ MapperEvent.__init__(self, conf, mapper, oid, classification)
self.obj_db = obj_db
self.obj = obj
self.upos = []
@@ -99,8 +99,8 @@
class DeserializationEvent (SDEvent):
__implements__ = interfaces.IFullDeserializationEvent
- def __init__(self, conf, mapper, oid, obj_db, obj):
- SDEvent.__init__(self, conf, mapper, oid, obj_db, obj)
+ def __init__(self, conf, mapper, oid, classification, obj_db, obj):
+ SDEvent.__init__(self, conf, mapper, oid, classification, obj_db, obj)
self._loaded_refs = {} # { (serializer_name, name) -> object }
# IDeserializationEvent interface methods:
@@ -129,8 +129,8 @@
class SerializationEvent (SDEvent):
__implements__ = interfaces.IFullSerializationEvent
- def __init__(self, conf, mapper, oid, obj_db, obj):
- SDEvent.__init__(self, conf, mapper, oid, obj_db, obj)
+ def __init__(self, conf, mapper, oid, classification, obj_db, obj):
+ SDEvent.__init__(self, conf, mapper, oid, classification, obj_db, obj)
self._attrs = {}
# _internal_refs:
# id(ob) -> (serializer_name, name)
=== Products/Ape/lib/apelib/core/interfaces.py 1.14 => 1.15 ===
--- Products/Ape/lib/apelib/core/interfaces.py:1.14 Fri Mar 26 10:52:48 2004
+++ Products/Ape/lib/apelib/core/interfaces.py Fri Mar 26 11:07:59 2004
@@ -118,15 +118,15 @@
oid = Attribute("oid", "The OID of the object being mapped")
+ classification = Attribute(
+ "classification", "The classification of the object.")
+
class IGatewayEvent (IMapperEvent):
"""Interface for events used by gateways."""
connections = Attribute(
"connections", "A mapping of database connections")
-
- classification = Attribute(
- "classification", "The classification of the object.")
class ILoadEvent (IGatewayEvent):
=== Products/Ape/lib/apelib/core/io.py 1.11 => 1.12 ===
--- Products/Ape/lib/apelib/core/io.py:1.11 Fri Mar 26 10:52:48 2004
+++ Products/Ape/lib/apelib/core/io.py Fri Mar 26 11:07:59 2004
@@ -86,7 +86,7 @@
initializer.init(event)
def classify_state(self, oid):
- event = LoadEvent(self.conf, None, oid, self.conn_map, None)
+ event = LoadEvent(self.conf, None, oid, None, self.conn_map)
# Returns classification
return self.conf.classifier.classify_state(event)
@@ -94,15 +94,16 @@
classification = self.classify_state(oid)
mapper_name = classification['mapper_name']
mapper = self.conf.mappers[mapper_name]
- event = LoadEvent(self.conf, mapper, oid, self.conn_map, classification)
+ event = LoadEvent(
+ self.conf, mapper, oid, classification, self.conn_map)
state, hash_value = mapper.gateway.load(event)
return event, classification, state, hash_value
def store(self, oid, classification, state, is_new):
mapper_name = classification['mapper_name']
mapper = self.conf.mappers[mapper_name]
- event = StoreEvent(self.conf, mapper, oid, self.conn_map,
- classification, is_new)
+ event = StoreEvent(
+ self.conf, mapper, oid, classification, self.conn_map, is_new)
# Store the classification first
self.conf.classifier.gateway.store(event, classification)
# Store the state second
@@ -117,11 +118,12 @@
return {}
mapper_name = classification['mapper_name']
mapper = self.conf.mappers[mapper_name]
- event = LoadEvent(self.conf, mapper, oid, self.conn_map, classification)
+ event = LoadEvent(
+ self.conf, mapper, oid, classification, self.conn_map)
return mapper.gateway.get_sources(event)
def new_oid(self):
- event = GatewayEvent(self.conf, None, None, self.conn_map, None)
+ event = GatewayEvent(self.conf, None, None, None, self.conn_map)
return self.conf.oid_gen.new_oid(event)
@@ -136,7 +138,8 @@
self.obj_db = obj_db
def classify_object(self, obj, oid):
- event = SerializationEvent(self.conf, None, oid, self.obj_db, obj)
+ event = SerializationEvent(
+ self.conf, None, oid, None, self.obj_db, obj)
# Returns classification
return self.conf.classifier.classify_object(event)
@@ -144,14 +147,16 @@
classification = self.classify_object(obj, oid)
mapper_name = classification['mapper_name']
mapper = self.conf.mappers[mapper_name]
- event = SerializationEvent(self.conf, mapper, oid, self.obj_db, obj)
+ event = SerializationEvent(
+ self.conf, mapper, oid, classification, self.obj_db, obj)
state = mapper.serializer.serialize(event)
return event, classification, state
def deserialize(self, oid, obj, classification, state):
mapper_name = classification['mapper_name']
mapper = self.conf.mappers[mapper_name]
- event = DeserializationEvent(self.conf, mapper, oid, self.obj_db, obj)
+ event = DeserializationEvent(
+ self.conf, mapper, oid, classification, self.obj_db, obj)
mapper.serializer.deserialize(event, state)
return event
More information about the Zope-CVS
mailing list