[Zope-CVS] CVS: Products/AdaptableStorage/serial_ofs - OFSProperties.py:1.4

Shane Hathaway shane@zope.com
Mon, 3 Mar 2003 17:55:54 -0500


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

Modified Files:
	OFSProperties.py 
Log Message:
When there are no stored properties, revert the property schema to the class
default.  (This makes it possible to set the title of a newly-created
filesystem directory.)


=== Products/AdaptableStorage/serial_ofs/OFSProperties.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/serial_ofs/OFSProperties.py:1.3	Tue Jan 21 11:49:43 2003
+++ Products/AdaptableStorage/serial_ofs/OFSProperties.py	Mon Mar  3 17:55:23 2003
@@ -81,6 +81,13 @@
     def deserialize(self, object, event, state):
         assert isinstance(object, PropertyManager)
         assert object._properties is object._propertyMap()
+        if not state:
+            # No stored properties.  Revert the object to its
+            # class-defined property schema.
+            if object.__dict__.has_key('_properties'):
+                del object._properties
+            return
+
         old_props = object.propdict()
         new_props = {}
         for id, t, v in state: