Commit 2907b5c2 authored by Jérome Perrin's avatar Jérome Perrin

2008-04-01 Jerome

* Add utility scripts to help in writing domain generation scripts: BaseDomain_generateDomainFromCurrentDocument and BaseDomain_generateDomainFromSelection.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20254 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fafdf694
<?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>
<?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>
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,
......
772
\ No newline at end of file
774
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment