[Erp5-report] r36696 kazuhiko - in /erp5/trunk/bt5/erp5_simulation: SkinTemplateItem/portal...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jun 29 15:49:49 CEST 2010


Author: kazuhiko
Date: Tue Jun 29 15:49:48 2010
New Revision: 36696

URL: http://svn.erp5.org?rev=36696&view=rev
Log:
rewrite sample script to follow recent changes.

Added:
    erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyListDict.xml
Modified:
    erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml
    erp5/trunk/bt5/erp5_simulation/bt/revision

Modified: erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml?rev=36696&r1=36695&r2=36696&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml [utf8] Tue Jun 29 15:49:48 2010
@@ -54,33 +54,15 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>"""\n
-returns the list of possible values.\n
-"""\n
-# XXX it does not support multiple tested properties.\n
-if configurable.getPortalType() == \'Solver Decision\':\n
-  solved_property = configurable.getCausalityValue(). \\\n
-                    getTestedProperty()\n
-else:\n
-  solved_property = configurable.getCausalityValue().getCausalityValue(). \\\n
-                    getTestedProperty()\n
+This script returns a dictionary of default properties for Unify Solver.\n
 \n
-value_list = []\n
-for movement in configurable.getDeliveryValueList():\n
-  value = movement.getProperty(solved_property)\n
-  if value not in value_list:\n
-    value_list.append(value)\n
-  simulation_movement_list = movement.getDeliveryRelatedValueList()\n
-  # if movement here is a delivery, we need to find simulation\n
-  # movements by its movements.\n
-  if len(simulation_movement_list) == 0:\n
-    simulation_movement_list = sum(\n
-      [x.getDeliveryRelatedValueList() \\\n
-       for x in configurable.getDeliveryValue().getMovementList()], [])\n
-  for simulation_movement in simulation_movement_list:\n
-    value = simulation_movement.getProperty(solved_property)\n
-    if value not in value_list:\n
-      value_list.append(value)\n
-return {\'value_list\':[(x, str(x)) for x in value_list]}\n
+This is a sample implementation that returns the first item in each list.\n
+"""\n
+value_list_dict = context.UnifySolver_getDefaultConfigurationPropertyListDict()\n
+value_dict = {}\n
+for property_id, value_list in value_list_dict.items():\n
+  value_dict[proeprty_id] = value_list[0]\n
+return value_dict\n
 </string> </value>
         </item>
         <item>
@@ -91,7 +73,7 @@ return {\'value_list\':[(x, str(x)) for 
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>configurable</string> </value>
+            <value> <string></string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -111,27 +93,22 @@ return {\'value_list\':[(x, str(x)) for 
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>0</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>configurable</string>
                             <string>_getattr_</string>
-                            <string>solved_property</string>
-                            <string>value_list</string>
+                            <string>context</string>
+                            <string>value_list_dict</string>
+                            <string>value_dict</string>
                             <string>_getiter_</string>
-                            <string>movement</string>
-                            <string>value</string>
-                            <string>simulation_movement_list</string>
-                            <string>len</string>
-                            <string>sum</string>
-                            <string>append</string>
-                            <string>$append0</string>
-                            <string>x</string>
-                            <string>simulation_movement</string>
-                            <string>str</string>
+                            <string>property_id</string>
+                            <string>value_list</string>
+                            <string>_getitem_</string>
+                            <string>_write_</string>
+                            <string>proeprty_id</string>
                           </tuple>
                         </value>
                     </item>

Added: erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyListDict.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyListDict.xml?rev=36696&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyListDict.xml (added)
+++ erp5/trunk/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyListDict.xml [utf8] Tue Jun 29 15:49:48 2010
@@ -0,0 +1,156 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>"""\n
+This script returns a dictionary of possible values for Unify Solver.\n
+"""\n
+solver_decision = context.getCausalityValue()\n
+tester = solver_decision.getCausalityValue()\n
+value_list_dict = {}\n
+for property_id in tester.getTestedProperty():\n
+  value_list = []\n
+  for simulation_movement in configurable.getDeliveryValueList():\n
+    movement = simulation_movement.getDeliveryValue()\n
+    value = movement.getProperty(property_id)\n
+    if value not in value_list:\n
+      value_list.append(value)\n
+    simulation_movement_list = movement.getDeliveryRelatedValueList()\n
+    value = simulation_movement.getProperty(property_id)\n
+    if value not in value_list:\n
+      value_list.append(value)\n
+  value_list_dict[property_id] = [(x, repr(x)) for x in value_list]\n
+return value_list_dict\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>solver_decision</string>
+                            <string>tester</string>
+                            <string>value_list_dict</string>
+                            <string>_getiter_</string>
+                            <string>property_id</string>
+                            <string>value_list</string>
+                            <string>configurable</string>
+                            <string>simulation_movement</string>
+                            <string>movement</string>
+                            <string>value</string>
+                            <string>simulation_movement_list</string>
+                            <string>append</string>
+                            <string>$append0</string>
+                            <string>x</string>
+                            <string>repr</string>
+                            <string>_write_</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>UnifySolver_getDefaultConfigurationPropertyListDict</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_simulation/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_simulation/bt/revision?rev=36696&r1=36695&r2=36696&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_simulation/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_simulation/bt/revision [utf8] Tue Jun 29 15:49:48 2010
@@ -1 +1 @@
-119
\ No newline at end of file
+120
\ No newline at end of file




More information about the Erp5-report mailing list