[Erp5-report] r13748 - in /erp5/trunk/bt5/erp5_forge: SkinTemplateItem/portal_skins/erp5_to...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 28 12:32:53 CEST 2007


Author: bartek
Date: Wed Mar 28 12:32:50 2007
New Revision: 13748

URL: http://svn.erp5.org?rev=13748&view=rev
Log:
simulation tree viewer - shows tree of simulations related to context. To be beautified. Contributed by Luke.

Added:
    erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getSimulationTree.xml
    erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_viewSimulationTree.xml
Modified:
    erp5/trunk/bt5/erp5_forge/bt/revision

Added: erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getSimulationTree.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getSimulationTree.xml?rev=13748&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getSimulationTree.xml (added)
+++ erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getSimulationTree.xml Wed Mar 28 12:32:50 2007
@@ -1,0 +1,205 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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 encoding="cdata"><![CDATA[
+
+# License: GPL\n
+# Author: Lukasz Nowak <lukasz.nowak at ventis.com.pl>\n
+# Copyright 2007 Ventis s. c.\n
+# SYNOPSIS\n
+# This script exctracts simulations (Applied Rule and Simulation Movement) for context.\n
+# If start_path is given it instead extracts tree with root as given start_path.\n
+\n
+\n
+def getByRecurse(obj,rv=[]):\n
+  rv = []\n
+  for o in [q.getObject() for q in obj.searchFolder()]:\n
+    rv.append(getByRecurse(o))\n
+  return rv\n
+\n
+def getFromCatalog(start_path):\n
+  return [x.getObject() for x in context.portal_catalog(\n
+    portal_type=(\'Applied Rule\',\'Simulation Movement\',),\n
+    path=start_path+\'%%\',\n
+    sort_on=((\'path\',\'ascending\',\'string\'),)\n
+  )]\n
+\n
+if start_path is None:\n
+  # we have to detect simulations\n
+  if context.getPortalType() in [\'Simulation Movement\',\'Applied Rule\']:\n
+    # we are run from simulation, its our root\n
+    start_paths = [context.getPath(),]\n
+  else:\n
+    # hm, it might be, that our context have simulations in relate objects?\n
+    start_paths = [x.getPath() for x in context.portal_categories.getRelatedValueList(context,portal_type=[\'Simulation Movement\',\'Applied Rule\'])]\n
+else:\n
+  start_paths = [start_path,]\n
+if start_paths == []:\n
+  # we are in no simulation related object\n
+  print \'No related simulations found\'\n
+  return printed\n
+\n
+print \'%s simulation related path found.\'%(len(start_paths),)\n
+related_simulations = {}\n
+for start_path in start_paths:\n
+\n
+  related_simulations[start_path] = getFromCatalog(start_path)\n
+\n
+return related_simulations\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>start_path=None</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>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>start_path</string>
+                            <string>_print_</string>
+                            <string>_print</string>
+                            <string>getByRecurse</string>
+                            <string>getFromCatalog</string>
+                            <string>None</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>start_paths</string>
+                            <string>append</string>
+                            <string>$append0</string>
+                            <string>_getiter_</string>
+                            <string>x</string>
+                            <string>len</string>
+                            <string>related_simulations</string>
+                            <string>_write_</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Base_getSimulationTree</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Added: erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_viewSimulationTree.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_viewSimulationTree.xml?rev=13748&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_viewSimulationTree.xml (added)
+++ erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_viewSimulationTree.xml Wed Mar 28 12:32:50 2007
@@ -1,0 +1,177 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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 encoding="cdata"><![CDATA[
+
+# License: GPL\n
+# Author: Lukasz Nowak <lukasz.nowak at ventis.com.pl>\n
+# Copyright 2007 Ventis s. c.\n
+\n
+simulations_found = context.Base_getSimulationTree(start_path=start_path)\n
+\n
+if len(simulations_found) == 0:\n
+  print \'No simulations related\'\n
+else:\n
+  for simulation_root in simulations_found.iterkeys():\n
+    print simulation_root\n
+    for simulation in simulations_found[simulation_root]:\n
+      print \'\\t\',simulation.getPath(),simulation.getPortalType(),\n
+      if simulation.getPortalType() == \'Simulation Movement\':\n
+        print simulation.getCausalityState(),\n
+      else:\n
+        print \'nostate\',\n
+      print simulation.getCategoriesList()\n
+\n
+return printed\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>start_path=None</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>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>start_path</string>
+                            <string>_print_</string>
+                            <string>_print</string>
+                            <string>_getattr_</string>
+<string>context</string>
+                            <string>simulations_found</string>
+                            <string>len</string>
+                            <string>_getiter_</string>
+                            <string>simulation_root</string>
+                            <string>_getitem_</string>
+                            <string>simulation</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Base_viewSimulationTree</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_forge/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/bt/revision?rev=13748&r1=13747&r2=13748&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_forge/bt/revision (original)
+++ erp5/trunk/bt5/erp5_forge/bt/revision Wed Mar 28 12:32:50 2007
@@ -1,1 +1,1 @@
-120
+127




More information about the Erp5-report mailing list