[Erp5-report] r28766 - in /erp5/trunk/products/ERP5: ./ Document/ interfaces/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 3 10:28:06 CEST 2009


Author: luke
Date: Thu Sep  3 10:28:04 2009
New Revision: 28766

URL: http://svn.erp5.org?rev=28766&view=rev
Log:
 - rename class DivergenceDecision to DivergenceSolutionDecision as previous name was not describing properly its usage

Added:
    erp5/trunk/products/ERP5/DivergenceSolutionDecision.py
      - copied, changed from r28763, erp5/trunk/products/ERP5/DivergenceDecision.py
Removed:
    erp5/trunk/products/ERP5/DivergenceDecision.py
Modified:
    erp5/trunk/products/ERP5/Document/DeliveryLine.py
    erp5/trunk/products/ERP5/Document/Rule.py
    erp5/trunk/products/ERP5/__init__.py
    erp5/trunk/products/ERP5/interfaces/divergence_solver.py

Removed: erp5/trunk/products/ERP5/DivergenceDecision.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/DivergenceDecision.py?rev=28765&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/DivergenceDecision.py [utf8] (original)
+++ erp5/trunk/products/ERP5/DivergenceDecision.py (removed)
@@ -1,106 +1,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
-#                    Łukasz Nowak <luke 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-##############################################################################
-
-from Globals import InitializeClass
-from Products.PythonScripts.Utility import allow_class
-from AccessControl import ClassSecurityInfo
-from Persistence import Persistent
-
-class DivergenceDecision(Persistent):
-  """Decision class
-
-    Represent decision took during solving divergence between reality and
-    simulation
-
-    Provides possibility to override movement's property value in case of
-    accepting decision with forcing.
-
-    Properties are two types - historical only and really used.
-
-    Historical only are for information traceability:
-
-      * delivery_solver_name
-      * target_solver_name
-
-    Really used shall impact property value of movement:
-
-      * divergence
-      * decision
-      * force_property
-
-    divergence
-      instance of DivergenceMessage
-
-    decision
-      string representing took decision:
-        * accept
-        * adopt
-        * split
-
-    delivery_solver_name
-      delivery solver used during taking decision
-
-    target_solver_name
-      target solver used during taking decision
-
-    force_property
-      If set, property on decision overrides
-
-    split_kw
-      Dictionary passed to TargetSolver in case of splitting.
-  """
-  meta_type = "DivergenceDecision"
-  security = ClassSecurityInfo()
-  security.declareObjectPublic() # FIXME need to be decided
-
-  # XXX: Is there any place to know all possible decisions?
-  ALLOWED_DECISION_TUPLE = ('accept', 'adopt', 'split')
-
-  def __repr__(self):
-    repr_str = '<%s object at 0x%x\n' % (self.__class__.__name__, id(self))
-    for prop in 'divergence', 'decision', 'delivery_solver_name', \
-                'target_solver_name', 'force_property':
-      repr_str += '%s = %r\n' % (prop, getattr(self, prop))
-    repr_str += '>'
-    return repr_str
-
-  def __init__(self, divergence, decision, delivery_solver_name,
-      target_solver_name, force_property=False, split_kw=None):
-    self.divergence = divergence
-    self.decision = decision
-    self.delivery_solver_name = delivery_solver_name
-    self.target_solver_name = target_solver_name
-    self.force_property = force_property
-    self.split_kw = split_kw
-    if not (self.decision in self.ALLOWED_DECISION_TUPLE):
-      raise ValueError(
-        'Decision %s is not supported' % self.decision)
-
-InitializeClass(DivergenceDecision)
-allow_class(DivergenceDecision)

Copied: erp5/trunk/products/ERP5/DivergenceSolutionDecision.py (from r28763, erp5/trunk/products/ERP5/DivergenceDecision.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/DivergenceSolutionDecision.py?p2=erp5/trunk/products/ERP5/DivergenceSolutionDecision.py&p1=erp5/trunk/products/ERP5/DivergenceDecision.py&r1=28763&r2=28766&rev=28766&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/DivergenceDecision.py [utf8] (original)
+++ erp5/trunk/products/ERP5/DivergenceSolutionDecision.py [utf8] Thu Sep  3 10:28:04 2009
@@ -32,7 +32,7 @@
 from AccessControl import ClassSecurityInfo
 from Persistence import Persistent
 
-class DivergenceDecision(Persistent):
+class DivergenceSolutionDecision(Persistent):
   """Decision class
 
     Represent decision took during solving divergence between reality and
@@ -75,7 +75,7 @@
     split_kw
       Dictionary passed to TargetSolver in case of splitting.
   """
-  meta_type = "DivergenceDecision"
+  meta_type = "DivergenceSolutionDecision"
   security = ClassSecurityInfo()
   security.declareObjectPublic() # FIXME need to be decided
 
@@ -102,5 +102,5 @@
       raise ValueError(
         'Decision %s is not supported' % self.decision)
 
-InitializeClass(DivergenceDecision)
-allow_class(DivergenceDecision)
+InitializeClass(DivergenceSolutionDecision)
+allow_class(DivergenceSolutionDecision)

Modified: erp5/trunk/products/ERP5/Document/DeliveryLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/DeliveryLine.py?rev=28766&r1=28765&r2=28766&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/DeliveryLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/DeliveryLine.py [utf8] Thu Sep  3 10:28:04 2009
@@ -508,12 +508,12 @@
       """How to play
 delivery_line = context
 from DateTime import DateTime
-from Products.ERP5.DivergenceDecision import DivergenceDecision
+from Products.ERP5.DivergenceSolutionDecision import DivergenceSolutionDecision
 decision_list = []
 
 # adopt
 for d in context.getDivergenceList():
-  decision = DivergenceDecision(d, 'adopt', None, None)
+  decision = DivergenceSolutionDecision(d, 'adopt', None, None)
   decision_list.append(decision)
 
 delivery_line.solve(decision_list)
@@ -525,7 +525,7 @@
     split_kw = {}
     split_kw.update(start_date = DateTime('2009/01/01'),
                     stop_date = DateTime('2009/01/10'))
-    decision = DivergenceDecision(d, 'split', None, 'SplitAndDefer',
+    decision = DivergenceSolutionDecision(d, 'split', None, 'SplitAndDefer',
                                   split_kw = split_kw)
     decision_list.append(decision)
 
@@ -535,7 +535,7 @@
 # adopt
 for d in delivery_line.getDivergenceList():
   if d.tested_property == 'quantity':
-    decision = DivergenceDecision(d, 'adopt', None, None)
+    decision = DivergenceSolutionDecision(d, 'adopt', None, None)
     decision_list.append(decision)
 
 delivery_line.solve(decision_list)

Modified: erp5/trunk/products/ERP5/Document/Rule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Rule.py?rev=28766&r1=28765&r2=28766&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Rule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Rule.py [utf8] Thu Sep  3 10:28:04 2009
@@ -375,7 +375,7 @@
             # TODO: support compensation if not prevent_compensation
             LOG('%s:%s' % (self.getRelativeUrl(), movement.getRelativeUrl()), WARNING,
                 'Quantity forced to stay as %s, even if wanted %s' % (m_quantity, prevision.get('quantity')))
-            # DivergenceDecision mangle
+            # DivergenceSolutionDecision mangle
             pass
           else:
             q_diff = prevision.get('quantity') - m_quantity
@@ -402,7 +402,7 @@
                   # support compensation if not prevent_compensation
                   LOG('%s:%s' % (self.getRelativeUrl(), movement.getRelativeUrl()), WARNING,
                       'Property %s forced to stay as %r, even if wanted %r' % (k, movement.getProperty(k), v))
-                  # DivergenceDecision mangle
+                  # DivergenceSolutionDecision mangle
                   continue
                 prop_dict.setdefault(k, v)
 

Modified: erp5/trunk/products/ERP5/__init__.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/__init__.py?rev=28766&r1=28765&r2=28766&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/__init__.py [utf8] (original)
+++ erp5/trunk/products/ERP5/__init__.py [utf8] Thu Sep  3 10:28:04 2009
@@ -99,8 +99,8 @@
                                                    'WorkflowException')
   ModuleSecurityInfo('Products.ERP5.Document.Image').declarePublic(
                                                 'getSizeFromImageDisplay')
-  ModuleSecurityInfo('Products.ERP5.DivergenceDecision').declarePublic(
-                                                'DivergenceDecision')
+  ModuleSecurityInfo('Products.ERP5.DivergenceSolutionDecision') \
+      .declarePublic('DivergenceSolutionDecision')
 
 # backward compatibility names
 XML = None

Modified: erp5/trunk/products/ERP5/interfaces/divergence_solver.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/interfaces/divergence_solver.py?rev=28766&r1=28765&r2=28766&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/interfaces/divergence_solver.py [utf8] (original)
+++ erp5/trunk/products/ERP5/interfaces/divergence_solver.py [utf8] Thu Sep  3 10:28:04 2009
@@ -35,7 +35,7 @@
   def solve(decision_list):
     """Solves divergences on self according to decision_list
 
-    decision_list is list of instances of DivergenceDecision class
+    decision_list is list of instances of DivergenceSolutionDecision class
     """
 
 class IDeliverySolver(Interface):




More information about the Erp5-report mailing list