[Erp5-report] r39363 arnaud.fontaine - in /erp5/trunk/products/ERP5Type: Core/ mixin/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Oct 19 18:55:28 CEST 2010


Author: arnaud.fontaine
Date: Tue Oct 19 18:55:28 2010
New Revision: 39363

URL: http://svn.erp5.org?rev=39363&view=rev
Log:
Declare base Constraint class as a mixin rather than a document


Added:
    erp5/trunk/products/ERP5Type/mixin/constraint.py
      - copied, changed from r39348, erp5/trunk/products/ERP5Type/Core/Constraint.py
Removed:
    erp5/trunk/products/ERP5Type/Core/Constraint.py
Modified:
    erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py
    erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py

Modified: erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py?rev=39363&r1=39362&r2=39363&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py [utf8] Tue Oct 19 18:55:28 2010
@@ -28,11 +28,11 @@
 #
 ##############################################################################
 
-from Products.ERP5Type.Core.Constraint import Constraint
+from Products.ERP5Type.mixin.constraint import ConstraintMixin
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type import Permissions
 
-class CategoryExistenceConstraint(Constraint):
+class CategoryExistenceConstraint(ConstraintMixin):
   """
   This constraint checks whether a category has been defined on this
   object (without acquisition). This is only relevant for ZODB

Removed: erp5/trunk/products/ERP5Type/Core/Constraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/Constraint.py?rev=39362&view=auto
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/Constraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/Constraint.py (removed)
@@ -1,90 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2002-2010 Nexedi SARL and Contributors. All Rights Reserved.
-#                         Sebastien Robin <seb at nexedi.com>
-#                         Jean-Paul Smets <jp at nexedi.com>
-#                         Courteaud Romain <romain at nexedi.com>
-#                         Arnaud Fontaine <arnaud.fontaine at nexedi.com>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability 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
-# garantees 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-##############################################################################
-
-from Products.ERP5Type.interfaces import IConstraint
-from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage
-from zope.interface import implements
-from Products.ERP5Type.Core.Predicate import Predicate
-from AccessControl import ClassSecurityInfo
-from Products.ERP5Type import Permissions
-from Products.ERP5Type.Utils import UpperCase
-
-class Constraint(Predicate):
-  """
-  Constraint implementation (only relevant for ZODB Property sheets,
-  use Products.ERP5Type.Constraint instead for filesystem Property
-  Sheets) relying on Predicate
-  """
-  meta_type = 'ERP5 Constraint'
-  portal_type = 'Constraint'
-
-  # Declarative security
-  security = ClassSecurityInfo()
-  security.declareObjectProtected(Permissions.AccessContentsInformation)
-
-  __allow_access_to_unprotected_subobjects__ = 1
-  implements( IConstraint, )
-
-  _message_id_list = []
-
-  def _getMessage(self, message_id):
-    """
-    Get the message corresponding to this message_id.
-    """
-    return getattr(self, 'get' + UpperCase(message_id))()
-
-  def _generateError(self, obj, error_message, mapping={}):
-    """
-    Generic method used to generate error in checkConsistency.
-    """
-    if error_message is not None:
-      msg = ConsistencyMessage(self,
-                               object_relative_url=obj.getRelativeUrl(),
-                               message=error_message,
-                               mapping=mapping)
-      return msg
-
-  security.declareProtected(Permissions.AccessContentsInformation,
-                            'checkConsistency')
-  def checkConsistency(self, obj, fixit=0, **kw):
-    """
-    Default method is to return no error.
-    """
-    errors = []
-    return errors
-
-  security.declareProtected(Permissions.AccessContentsInformation,
-                            'fixConsistency')
-  def fixConsistency(self, obj, **kw):
-    """
-    Default method is to call checkConsistency with fixit set to 1
-    """
-    return self.checkConsistency(obj, fixit=1, **kw)

Modified: erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py?rev=39363&r1=39362&r2=39363&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py [utf8] Tue Oct 19 18:55:28 2010
@@ -28,11 +28,11 @@
 #
 ##############################################################################
 
-from Products.ERP5Type.Core.Constraint import Constraint
+from Products.ERP5Type.mixin.constraint import ConstraintMixin
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type import Permissions
 
-class PropertyExistenceConstraint(Constraint):
+class PropertyExistenceConstraint(ConstraintMixin):
   """
   This constraint checks whether a property has been defined on this
   object. This is only relevant for ZODB Property Sheets (filesystem

Copied: erp5/trunk/products/ERP5Type/mixin/constraint.py (from r39348, erp5/trunk/products/ERP5Type/Core/Constraint.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/mixin/constraint.py?p2=erp5/trunk/products/ERP5Type/mixin/constraint.py&p1=erp5/trunk/products/ERP5Type/Core/Constraint.py&r1=39348&r2=39363&rev=39363&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/Constraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/mixin/constraint.py [utf8] Tue Oct 19 18:55:28 2010
@@ -37,15 +37,12 @@ from AccessControl import ClassSecurityI
 from Products.ERP5Type import Permissions
 from Products.ERP5Type.Utils import UpperCase
 
-class Constraint(Predicate):
+class ConstraintMixin(Predicate):
   """
-  Constraint implementation (only relevant for ZODB Property sheets,
-  use Products.ERP5Type.Constraint instead for filesystem Property
-  Sheets) relying on Predicate
+  Mixin Constraint implementation (only relevant for ZODB Property
+  sheets, use Products.ERP5Type.Constraint instead for filesystem
+  Property Sheets) relying on Predicate
   """
-  meta_type = 'ERP5 Constraint'
-  portal_type = 'Constraint'
-
   # Declarative security
   security = ClassSecurityInfo()
   security.declareObjectProtected(Permissions.AccessContentsInformation)




More information about the Erp5-report mailing list