[Erp5-report] r20254 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplateItem/p...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 1 18:06:57 CEST 2008


Author: jerome
Date: Tue Apr  1 18:06:56 2008
New Revision: 20254

URL: http://svn.erp5.org?rev=20254&view=rev
Log:
2008-04-01 Jerome
* Add utility scripts to help in writing domain generation scripts: BaseDomain_generateDomainFromCurrentDocument and BaseDomain_generateDomainFromSelection.

Added:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromCurrentDocument.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromSelection.xml
Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Added: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromCurrentDocument.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromCurrentDocument.xml?rev=20254&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromCurrentDocument.xml (added)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromCurrentDocument.xml Tue Apr  1 18:06:56 2008
@@ -1,0 +1,189 @@
+<?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>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>"""This script generates a domain containing only the current document.\n
+This is usefull for planning box, where a domain is always required.\n
+\n
+It\'s not supposed to be used directly, but wrapped in another script that will pass those parameters:\n
+ * script_id: the ID of the wrapper script (subdomains will be regenerated with this script);\n
+ * membership_criterion_base_category: base categories that will be set on generated domains.\n
+"""\n
+\n
+if depth != 0:\n
+  return []\n
+\n
+domain_list = []\n
+portal = context.getPortalObject()\n
+request = portal.REQUEST\n
+here = request.get(\'here\', None)\n
+if here is None:\n
+  # Sometimes the object is not in the request, when you edit for example.\n
+  here = request[\'PUBLISHED\'].aq_parent \n
+\n
+for category in (here, ):\n
+  domain = parent.generateTempDomain(id=category.getId())\n
+  domain.edit(title=category.getTitle(),\n
+              membership_criterion_base_category=membership_criterion_base_category,\n
+              membership_criterion_category=(category.getRelativeUrl(),),\n
+              domain_generator_method_id=script_id,\n
+              uid=category.getUid())\n
+                \n
+  domain_list.append(domain)\n
+\n
+return domain_list\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>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>script_id, membership_criterion_base_category, depth, parent, **kw</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>4</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>script_id</string>
+                            <string>membership_criterion_base_category</string>
+                            <string>depth</string>
+                            <string>parent</string>
+                            <string>kw</string>
+                            <string>domain_list</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>portal</string>
+                            <string>request</string>
+                            <string>None</string>
+                            <string>here</string>
+                            <string>_getitem_</string>
+                            <string>_getiter_</string>
+                            <string>category</string>
+                            <string>domain</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>BaseDomain_generateDomainFromCurrentDocument</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Added: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromSelection.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromSelection.xml?rev=20254&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromSelection.xml (added)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BaseDomain_generateDomainFromSelection.xml Tue Apr  1 18:06:56 2008
@@ -1,0 +1,185 @@
+<?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>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>"""This script generates a domain from selected objects in a module.\n
+\n
+It\'s not supposed to be used directly, but wrapped in another script that will pass those parameters:\n
+ * script_id: the ID of the wrapper script (subdomains will be regenerated with this script);\n
+ * selection_name: the selection name used by the listbox;\n
+ * membership_criterion_base_category: base categories that will be set on generated domains.\n
+"""\n
+\n
+if depth != 0:\n
+  return []\n
+\n
+domain_list = []\n
+portal = context.getPortalObject()\n
+category_list = portal.portal_selections.getSelectionCheckedValueList(selection_name)\n
+if not category_list:\n
+  category_list = portal.portal_selections.callSelectionFor(selection_name)\n
+\n
+for category in category_list:\n
+  domain = parent.generateTempDomain(id=category.getId())\n
+  domain.edit(title=category.getTitle(),\n
+              membership_criterion_base_category=membership_criterion_base_category,\n
+              membership_criterion_category=(category.getRelativeUrl(),),\n
+              domain_generator_method_id=script_id,\n
+              uid=category.getUid())\n
+                \n
+  domain_list.append(domain)\n
+\n
+return domain_list\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>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>script_id, selection_name, membership_criterion_base_category, depth, parent, **kw</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>5</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>script_id</string>
+                            <string>selection_name</string>
+                            <string>membership_criterion_base_category</string>
+                            <string>depth</string>
+                            <string>parent</string>
+                            <string>kw</string>
+                            <string>domain_list</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>portal</string>
+                            <string>category_list</string>
+                            <string>_getiter_</string>
+                            <string>category</string>
+                            <string>domain</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>BaseDomain_generateDomainFromSelection</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log?rev=20254&r1=20253&r2=20254&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log Tue Apr  1 18:06:56 2008
@@ -1,3 +1,6 @@
+2008-04-01 Jerome
+* Add utility scripts to help in writing domain generation scripts: BaseDomain_generateDomainFromCurrentDocument and BaseDomain_generateDomainFromSelection.
+
 2008-03-28 Yusei
 * Removed causality from acquired base categories on destination_administration,
 destination_decision, destination_payment,

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=20254&r1=20253&r2=20254&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Tue Apr  1 18:06:56 2008
@@ -1,1 +1,1 @@
-772
+774




More information about the Erp5-report mailing list