[Zope-CVS] CVS: Products/AdaptableStorage/serial_ofs - MetaTypeClassifier.py:1.8

Shane Hathaway shane@zope.com
Mon, 9 Dec 2002 15:27:39 -0500


Update of /cvs-repository/Products/AdaptableStorage/serial_ofs
In directory cvs.zope.org:/tmp/cvs-serv10661/serial_ofs

Modified Files:
	MetaTypeClassifier.py 
Log Message:
Added two mappers to Zope2FS for serializing any kind of object.  If no mapper
is provided for a class, the database falls back to a default mapper--either
the "fileish" or the "folderish" mapper.

... which is *really cool*. :-)  I've been trying to achieve this in a clean
way for months.  (Deeeeep, loooonnnnnggggg sigh of relief!)



=== Products/AdaptableStorage/serial_ofs/MetaTypeClassifier.py 1.7 => 1.8 ===
--- Products/AdaptableStorage/serial_ofs/MetaTypeClassifier.py:1.7	Mon Dec  9 13:25:28 2002
+++ Products/AdaptableStorage/serial_ofs/MetaTypeClassifier.py	Mon Dec  9 15:27:08 2002
@@ -89,7 +89,10 @@
             if mapper_name is None:
                 raise DeserializationError(
                     'No mapper known for meta_type %s' % repr(mt))
-        return {'meta_type': mt}, mapper_name
+        klass = value.__class__
+        ci = '%s:%s' % (klass.__module__, klass.__name__)
+        classification = {'meta_type': mt, 'class_name': ci}
+        return classification, mapper_name
 
 
     def classifyState(self, event):
@@ -115,11 +118,12 @@
             else:
                 raise DeserializationError(
                     'No classification known for %s' % repr(keychain))
+            classification['meta_type'] = mt
         mapper_name = self.mt_to_mapper.get(mt)
         if mapper_name is None:
             raise DeserializationError(
                 'No mapper known for meta_type %s' % repr(mt))
-        return {'meta_type': mt}, mapper_name
+        return classification, mapper_name
 
 
     def store(self, event, classification):