[Erp5-report] r30642 - in /erp5/trunk/products/ERP5: Document/ PropertySheet/ mixin/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 16 10:02:06 CET 2009


Author: kazuhiko
Date: Mon Nov 16 10:02:03 2009
New Revision: 30642

URL: http://svn.erp5.org?rev=30642&view=rev
Log:
store recorded properties in another PersistentMapping.

Removed:
    erp5/trunk/products/ERP5/PropertySheet/PropertyRecordable.py
Modified:
    erp5/trunk/products/ERP5/Document/SimulationMovement.py
    erp5/trunk/products/ERP5/mixin/property_recordable.py

Modified: erp5/trunk/products/ERP5/Document/SimulationMovement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SimulationMovement.py?rev=30642&r1=30641&r2=30642&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SimulationMovement.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/SimulationMovement.py [utf8] Mon Nov 16 10:02:03 2009
@@ -118,7 +118,6 @@
                     , PropertySheet.AppliedRule
                     , PropertySheet.ItemAggregation
                     , PropertySheet.Reference
-                    , PropertySheet.PropertyRecordable
                     )
 
   def tpValues(self) :

Removed: erp5/trunk/products/ERP5/PropertySheet/PropertyRecordable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/PropertyRecordable.py?rev=30641&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/PropertyRecordable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/PropertySheet/PropertyRecordable.py (removed)
@@ -1,39 +1,0 @@
-#############################################################################
-#
-# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsibility of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# guarantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-##############################################################################
-
-class PropertyRecordable:
-  """
-  Properties for property recordable documents
-  """
-
-  _properties = (
-    {'id'         :'recorded_property_dict',
-     'description':'The dict of recorded properties.',
-     'type'       :'data',
-     'mode'       :'w'
-    },
-  )

Modified: erp5/trunk/products/ERP5/mixin/property_recordable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/property_recordable.py?rev=30642&r1=30641&r2=30642&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/property_recordable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/property_recordable.py [utf8] Mon Nov 16 10:02:03 2009
@@ -29,6 +29,7 @@
 import zope.interface
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type import Permissions, interfaces
+from Products.ERP5Type.Globals import PersistentMapping
 
 class PropertyRecordableMixin:
   """
@@ -58,7 +59,7 @@
 
     id -- ID of the property
     """
-    recorded_property_dict = self.getRecordedPropertyDict({})
+    recorded_property_dict = self._getRecordedPropertyDict()
     # XXX it is better to use getPropertyList only for list type
     # properties or categories.
     recorded_property_dict[id] = self.getPropertyList(id)
@@ -71,7 +72,7 @@
     Clears a previously recorded property from
     the property record.
     """
-    recorded_property_dict = self.getRecordedPropertyDict({})
+    recorded_property_dict = self._getRecordedPropertyDict()
     try:
       del(recorded_property_dict[id])
     except KeyError:
@@ -86,7 +87,7 @@
     Returns the list of property IDs which have
     been recorded.
     """
-    return (self.getRecordedPropertyDict({}).keys())
+    return (self._getRecordedPropertyDict().keys())
 
   security.declareProtected(Permissions.AccessContentsInformation,
                             'isPropertyRecorded')
@@ -97,7 +98,7 @@
 
     id -- ID of the property
     """
-    return self.getRecordedPropertyDict({}).has_key(id)
+    return self._getRecordedPropertyDict().has_key(id)
 
   security.declareProtected(Permissions.AccessContentsInformation,
                             'getRecordedProperty')
@@ -107,7 +108,7 @@
 
     id -- ID of the property
     """
-    return self.getRecordedPropertyDict({})[id]
+    return self._getRecordedPropertyDict()[id]
 
   security.declareProtected(Permissions.AccessContentsInformation,
                             'asRecordedContext')
@@ -117,5 +118,10 @@
     which recorded properties in its context.
     """
     context = self.asContext()
-    context.edit(**self.getRecordedPropertyDict({}))
+    context.edit(**self._getRecordedPropertyDict())
     return context
+
+  def self._getRecordedPropertyDict(self):
+    if getattr(aq_base(self), '_recorded_property_dict', None) is None:
+      self._recorded_property_dict = PersistentMapping()
+    return self._recorded_property_dict




More information about the Erp5-report mailing list