[Erp5-report] r36842 kazuhiko - in /erp5/trunk: bt5/erp5_base/SkinTemplateItem/portal_skins...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jul 5 09:35:37 CEST 2010
Author: kazuhiko
Date: Mon Jul 5 09:35:35 2010
New Revision: 36842
URL: http://svn.erp5.org?rev=36842&view=rev
Log:
do not use type based method, but set method id in solver type itself.
Added:
erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_configuration_property_list_dict_method_id.xml
erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_default_configuration_property_dict_method_id.xml
Modified:
erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration.xml
erp5/trunk/bt5/erp5_base/bt/revision
erp5/trunk/products/ERP5/Document/SolverTypeInformation.py
erp5/trunk/products/ERP5/PropertySheet/SolverType.py
Modified: erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration.xml?rev=36842&r1=36841&r2=36842&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration.xml [utf8] Mon Jul 5 09:35:35 2010
@@ -99,9 +99,9 @@
<string>my_configuration_form_id</string>
<string>my_solver_action_title</string>
<string>my_configuration_property_list</string>
- <string>my_delivery_solver_list</string>
<string>my_tested_property_list</string>
- <string>my_automatic_solver</string>
+ <string>my_default_configuration_property_dict_method_id</string>
+ <string>my_configuration_property_list_dict_method_id</string>
</list>
</value>
</item>
@@ -109,6 +109,8 @@
<key> <string>right</string> </key>
<value>
<list>
+ <string>my_automatic_solver</string>
+ <string>my_delivery_solver_list</string>
<string>my_conflicting_solver_list</string>
<string>my_line_exclusive</string>
<string>my_configuration_groupable</string>
Added: erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_configuration_property_list_dict_method_id.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_configuration_property_list_dict_method_id.xml?rev=36842&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_configuration_property_list_dict_method_id.xml (added)
+++ erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_configuration_property_list_dict_method_id.xml [utf8] Mon Jul 5 09:35:35 2010
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>delegated_list</string> </key>
+ <value>
+ <list>
+ <string>display_width</string>
+ <string>title</string>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>my_configuration_property_list_dict_method_id</string> </value>
+ </item>
+ <item>
+ <key> <string>message_values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>external_validator_failed</string> </key>
+ <value> <string>The input failed the external validator.</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>overrides</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>tales</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>display_width</string> </key>
+ <value> <int>20</int> </value>
+ </item>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string>my_string_field</string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string>Base_viewFieldLibrary</string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string>Click to edit the target</string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string>Configuration Property List Dict Method</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Added: erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_default_configuration_property_dict_method_id.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_default_configuration_property_dict_method_id.xml?rev=36842&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_default_configuration_property_dict_method_id.xml (added)
+++ erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/SolverType_viewConfiguration/my_default_configuration_property_dict_method_id.xml [utf8] Mon Jul 5 09:35:35 2010
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>delegated_list</string> </key>
+ <value>
+ <list>
+ <string>display_width</string>
+ <string>title</string>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>my_default_configuration_property_dict_method_id</string> </value>
+ </item>
+ <item>
+ <key> <string>message_values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>external_validator_failed</string> </key>
+ <value> <string>The input failed the external validator.</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>overrides</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>tales</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>display_width</string> </key>
+ <value> <int>20</int> </value>
+ </item>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string>my_string_field</string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string>Base_viewFieldLibrary</string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string>Click to edit the target</string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string>Default Configuration Property Dict Method</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_base/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_base/bt/revision?rev=36842&r1=36841&r2=36842&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_base/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_base/bt/revision [utf8] Mon Jul 5 09:35:35 2010
@@ -1 +1 @@
-791
\ No newline at end of file
+792
\ No newline at end of file
Modified: erp5/trunk/products/ERP5/Document/SolverTypeInformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SolverTypeInformation.py?rev=36842&r1=36841&r2=36842&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SolverTypeInformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/SolverTypeInformation.py [utf8] Mon Jul 5 09:35:35 2010
@@ -30,7 +30,6 @@ from AccessControl import ClassSecurityI
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5.Document.Predicate import Predicate
-from Products.ERP5Type.Cache import getReadOnlyTransactionCache
class SolverTypeInformation(Predicate, ERP5TypeInformation):
"""
@@ -151,8 +150,11 @@ class SolverTypeInformation(Predicate, E
configurable -- a configurable document (Solver Decision
or Target Solver)
"""
- return self._callTypeBasedMethod(
- configurable, 'getDefaultConfigurationPropertyDict')
+ method_id = self.getDefaultConfigurationPropertyDictMethodId()
+ if method_id:
+ return self._callMethod(configurable, method_id, {})
+ else:
+ return {}
def getDefaultConfigurationProperty(self, property, configurable):
"""
@@ -166,7 +168,7 @@ class SolverTypeInformation(Predicate, E
"""
return self.getDefaultConfigurationPropertyDict().get(property, None)
- def getDefaultConfigurationPropertyListDict(self, configurable):
+ def getConfigurationPropertyListDict(self, configurable):
"""
Returns a dictionary of possible values for specified
configurable object
@@ -175,10 +177,13 @@ class SolverTypeInformation(Predicate, E
configurable -- a configurable document (Solver Decision
or Target Solver)
"""
- return self._callTypeBasedMethod(
- configurable, 'getDefaultConfigurationPropertyListDict')
+ method_id = self.getConfigurationPropertyListDictMethodId()
+ if method_id:
+ return self._callMethod(configurable, method_id, {})
+ else:
+ return {}
- def getDefaultConfigurationPropertyList(self, property, configurable):
+ def getConfigurationPropertyList(self, property, configurable):
"""
Returns a list of possible values for a given property
(public API)
@@ -186,41 +191,27 @@ class SolverTypeInformation(Predicate, E
configurable -- a configurable document (Solver Decision
or Target Solver)
"""
- return self.getDefaultConfigurationPropertyListDict().get(property, [])
+ return self.getConfigurationPropertyListDict().get(property, [])
- def _callTypeBasedMethod(self, configurable, method_id):
+ def _callMethod(self, configurable, method_id, default=None):
# Implemented through type based method
# and using read transaction cache
portal_type = configurable.getPortalType()
if portal_type == 'Solver Decision':
try:
solver_portal_type = configurable.getSolverValue().getId()
- solver = None
+ solver = configurable.getParentValue().newContent(
+ portal_type=solver_portal_type,
+ temp_object=True,
+ delivery_list=configurable.getDeliveryList(),
+ causality_value=configurable)
except AttributeError:
- return {}
+ return default
elif interfaces.ISolver.providedBy(configurable):
solver_portal_type = portal_type
solver = configurable
else:
raise NotImplementedError, '%s is not supported for configurable argument' % portal_type
- cache = getReadOnlyTransactionCache(self)
- if cache is not None:
- key = (method_id, solver_portal_type)
- try:
- return cache[key]()
- except KeyError:
- pass
-
- if solver is None:
- solver = configurable.getParentValue().newContent(
- portal_type=solver_portal_type,
- temp_object=True,
- delivery_list=configurable.getDeliveryList(),
- causality_value=configurable)
- method = solver._getTypeBasedMethod(
- method_id,
- fallback_script_id='Solver_%s' % method_id)
- if cache is not None:
- cache[key] = method
+ method = getattr(solver, method_id)
return method()
Modified: erp5/trunk/products/ERP5/PropertySheet/SolverType.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/SolverType.py?rev=36842&r1=36841&r2=36842&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/SolverType.py [utf8] (original)
+++ erp5/trunk/products/ERP5/PropertySheet/SolverType.py [utf8] Mon Jul 5 09:35:35 2010
@@ -73,6 +73,16 @@ class SolverType:
'mode': 'w',
'label': 'Solve automatically if True'
},
+ { 'id': 'default_configuration_property_dict_method_id',
+ 'type': 'string',
+ 'mode': 'w',
+ 'description':'the method used to get a dict of default properties.',
+ },
+ { 'id': 'configuration_property_list_dict_method_id',
+ 'type': 'string',
+ 'mode': 'w',
+ 'description':'the method used to get a dict of possible values.',
+ },
)
_categories = ('conflicting_solver',)
More information about the Erp5-report
mailing list