[Zope-CVS] CVS: Products/AdaptableStorage/serial_ofs - MetaTypeClassifier.py:1.3
Shane Hathaway
shane@zope.com
Thu, 5 Dec 2002 12:39:18 -0500
Update of /cvs-repository/Products/AdaptableStorage/serial_ofs
In directory cvs.zope.org:/tmp/cvs-serv16479/serial_ofs
Modified Files:
MetaTypeClassifier.py
Log Message:
The following comments might not make sense to anyone but me right now,
but someday it might be useful for historical purposes.
- Removed ClassificationAspect. This strategy simply can't work correctly.
The load() method of FSClassificationSection was using the wrong object
mapper to classify filenames (it was using the child's rather than the
container's object mapper), revealing that classification should be
known only to the container, not the object.
- Added a "preserve" write mode to FSConnection, enabling classification to
be preserved even though other sections get changed.
- Simplified FSClassificationSection using the new preserve write mode.
- Since ClassificationAspect no longer exists, nothing will ever delegate
aspect loading/storing to MetaTypeClassifier. Removed the methods that
implemented the IAspectSerializer interface.
- Now gateways can return None as the serial, making them invisible to the
hash computation.
- Added tests that verify that classifications get stored in preserve mode.
- Turned the debug flag back off :-)
=== Products/AdaptableStorage/serial_ofs/MetaTypeClassifier.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/serial_ofs/MetaTypeClassifier.py:1.2 Wed Dec 4 23:18:08 2002
+++ Products/AdaptableStorage/serial_ofs/MetaTypeClassifier.py Thu Dec 5 12:38:47 2002
@@ -20,30 +20,20 @@
from Acquisition import aq_base
-from serial_public import IClassifier, IAspectSerializer, \
- DeserializationError, RecordSchema
+from serial_public import IClassifier, DeserializationError
class MetaTypeClassifier:
"""A classifier based on meta_type attributes.
-
- Note that this class also implements IAspectSerializer, enabling
- delegation from ClassificationAspects.
"""
- __implements__ = IClassifier, IAspectSerializer
-
- schema = RecordSchema()
- schema.addColumn('classification', 'classification')
+ __implements__ = IClassifier
def __init__(self):
self.ext_to_mt = {}
self.mt_to_mapper = {}
self.fmt_to_mapper = {}
- def getSchema(self):
- return self.schema
-
def register(self, meta_type, mapper_name, extensions):
for ext in extensions:
if not ext.startswith('.'):
@@ -68,19 +58,6 @@
else:
fmt = 'file'
self.fmt_to_mapper[fmt] = mapper_name
-
-
- def serialize(self, object, event):
- c, mapper_name = self.classifyObject(object)
- event.notifySerialized('meta_type', object.meta_type, 1)
- return ((c,),)
-
-
- def deserialize(self, object, event, state):
- mt = state[0][0]['meta_type']
- if object.meta_type != mt:
- object.meta_type = mt
- event.notifyDeserialized('meta_type', mt)
def classifyObject(self, value):