[Erp5-report] r43544 jm - in /erp5/trunk/products/ERP5Type: ./ Core/ mixin/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 22 10:38:45 CET 2011


Author: jm
Date: Tue Feb 22 10:38:45 2011
New Revision: 43544

URL: http://svn.erp5.org?rev=43544&view=rev
Log:
Move IdAsReference class out of ERP5Type.mixin

Added:
    erp5/trunk/products/ERP5Type/id_as_reference.py
      - copied, changed from r43543, erp5/trunk/products/ERP5Type/mixin/id_as_reference.py
Removed:
    erp5/trunk/products/ERP5Type/mixin/id_as_reference.py
Modified:
    erp5/trunk/products/ERP5Type/Core/CategoryProperty.py
    erp5/trunk/products/ERP5Type/Core/StandardProperty.py
    erp5/trunk/products/ERP5Type/mixin/constraint.py

Modified: erp5/trunk/products/ERP5Type/Core/CategoryProperty.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/CategoryProperty.py?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/CategoryProperty.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/CategoryProperty.py [utf8] Tue Feb 22 10:38:45 2011
@@ -33,7 +33,7 @@ from Products.ERP5Type.XMLObject import 
 from Products.ERP5Type.Accessor.Base import Getter as BaseGetter
 from Products.ERP5Type.Accessor import Category, Value, Alias
 from Products.ERP5Type.Utils import UpperCase
-from Products.ERP5Type.mixin.id_as_reference import IdAsReferenceMixin
+from Products.ERP5Type.id_as_reference import IdAsReferenceMixin
 from Products.ERP5Type.Core.StandardProperty import StandardProperty
 from zLOG import LOG, WARNING
 

Modified: erp5/trunk/products/ERP5Type/Core/StandardProperty.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/StandardProperty.py?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/StandardProperty.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/StandardProperty.py [utf8] Tue Feb 22 10:38:45 2011
@@ -31,7 +31,7 @@ from Products.CMFCore.Expression import 
 from Products.ERP5Type import Permissions, PropertySheet
 from Products.ERP5Type.XMLObject import XMLObject
 from Products.ERP5Type.Accessor.Base import Getter as BaseGetter
-from Products.ERP5Type.mixin.id_as_reference import IdAsReferenceMixin
+from Products.ERP5Type.id_as_reference import IdAsReferenceMixin
 
 class StandardProperty(IdAsReferenceMixin('_property'), XMLObject):
   """

Copied: erp5/trunk/products/ERP5Type/id_as_reference.py (from r43543, erp5/trunk/products/ERP5Type/mixin/id_as_reference.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/id_as_reference.py?p2=erp5/trunk/products/ERP5Type/id_as_reference.py&p1=erp5/trunk/products/ERP5Type/mixin/id_as_reference.py&r1=43543&r2=43544&rev=43544&view=diff
==============================================================================
    (empty)

Modified: erp5/trunk/products/ERP5Type/mixin/constraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/mixin/constraint.py?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/mixin/constraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/mixin/constraint.py [utf8] Tue Feb 22 10:38:45 2011
@@ -37,7 +37,7 @@ from AccessControl import ClassSecurityI
 from Products.ERP5Type import Permissions, PropertySheet
 from Products.ERP5Type.Utils import UpperCase, createExpressionContext
 from Products.CMFCore.Expression import Expression
-from Products.ERP5Type.mixin.id_as_reference import IdAsReferenceMixin
+from Products.ERP5Type.id_as_reference import IdAsReferenceMixin
 
 class ConstraintMixin(IdAsReferenceMixin('_constraint'), Predicate):
   """

Removed: erp5/trunk/products/ERP5Type/mixin/id_as_reference.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/mixin/id_as_reference.py?rev=43543&view=auto
==============================================================================
--- erp5/trunk/products/ERP5Type/mixin/id_as_reference.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/mixin/id_as_reference.py (removed)
@@ -1,83 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
-#          Julien Muchembled <jm at nexedi.com>
-#
-# 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 advised 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.
-#
-##############################################################################
-
-import transaction
-from AccessControl import ClassSecurityInfo
-from Products.ERP5Type import Permissions, PropertySheet
-from Products.CMFActivity.Errors import ActivityPendingError
-from zLOG import LOG, WARNING
-
-def IdAsReferenceMixin(suffix):
-  suffix_index = - len(suffix)
-
-  class IdAsReferenceMixin(object):
-    # Declarative security
-    security = ClassSecurityInfo()
-    security.declareObjectProtected(Permissions.AccessContentsInformation)
-
-    def cb_isMoveable(self):
-      return self.cb_userHasCopyOrMovePermission()
-
-    def __migrate(self):
-      if self.id[suffix_index:] != suffix:
-        new_id = self.__dict__.get('default_reference') + suffix
-        parent = self.getParentValue()
-        if parent.has_key(new_id):
-          LOG("IdAsReferenceMixin", WARNING, "Skipping migration of %r in %r"
-              " property sheet, due to ID conflict" % (new_id, parent.getId()))
-        else:
-          try:
-            self.setId(new_id)
-            del self.default_reference
-          except ActivityPendingError:
-            LOG("IdAsReferenceMixin", WARNING, "Skipping migration of %r in %r"
-              " property sheet, due to pending activities" % 
-               (new_id, parent.getId()))
-            
-
-    security.declareProtected(Permissions.AccessContentsInformation,
-                              'getReference')
-    def getReference(self, default=None):
-      id = self.id
-      if id[suffix_index:] == suffix:
-        return id[:suffix_index]
-      # BBB
-      reference = self.__dict__.get('default_reference')
-      if reference:
-        transaction.get().addBeforeCommitHook(self.__migrate)
-        return reference
-      return default
-
-    def _setReference(self, value):
-      self.__dict__.pop('default_reference', None) # BBB
-      self.setId(value + suffix)
-
-    security.declareProtected(Permissions.ModifyPortalContent, 'setReference')
-    setReference = _setReference
-
-  return IdAsReferenceMixin



More information about the Erp5-report mailing list