Commit 3340da58 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Make it possible to define a depth for the generation process.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16550 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a643cc65
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -68,7 +65,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
<value> <string encoding="cdata"><![CDATA[
"""\n
This scripts browses recursively a to generate a mirror structure\n
within the current Web Section. It sets predicate parameters\n
on all categories excluding itself.\n
......@@ -94,7 +93,7 @@ def getNiceID(s):\n
s = s.replace(\'_\', \'-\')\n
return s\n
\n
def createWebSectionFromCategoryValue(container, category, section_id=None):\n
def createWebSectionFromCategoryValue(container, category, depth, section_id=None):\n
global section_count\n
if section_id is None:\n
try:\n
......@@ -155,8 +154,9 @@ def createWebSectionFromCategoryValue(container, category, section_id=None):\n
if new_section is not None:\n
# It is possible to browse objects which are not categories\n
# ex. Projects\n
for sub_category in category.contentValues():\n
createWebSectionFromCategoryValue(new_section, sub_category)\n
if depth > 0:\n
for sub_category in category.contentValues():\n
createWebSectionFromCategoryValue(new_section, sub_category, depth - 1)\n
# Remove sections which have no counterpart in categories\n
if remove_missing:\n
# XXX Not implemented yet\n
......@@ -165,7 +165,7 @@ def createWebSectionFromCategoryValue(container, category, section_id=None):\n
# Call the recursive section generator for each category\n
my_category_value = category_tool.restrictedTraverse(category)\n
base_category_id = my_category_value.getBaseCategory().getId()\n
createWebSectionFromCategoryValue(context, my_category_value, section_id=section_id)\n
createWebSectionFromCategoryValue(context, my_category_value, depth, section_id=section_id)\n
\n
# Warn about failures if any\n
if failed_list:\n
......@@ -178,7 +178,9 @@ if failed_list:\n
return context.Base_redirect(form_id,\n
keep_items = dict(portal_status_message = translateString("Generated ${section_count} sections for the Web Site.",\n
mapping = dict(section_count = section_count))))\n
</string> </value>
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
......@@ -200,7 +202,7 @@ return context.Base_redirect(form_id,\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>category, section_id, update_existing=0, remove_missing=0, form_id=\'view\', **kw</string> </value>
<value> <string>category, section_id, depth=1, update_existing=0, remove_missing=0, form_id=\'view\', **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -220,7 +222,7 @@ return context.Base_redirect(form_id,\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>5</int> </value>
<value> <int>6</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -228,6 +230,7 @@ return context.Base_redirect(form_id,\n
<tuple>
<string>category</string>
<string>section_id</string>
<string>depth</string>
<string>update_existing</string>
<string>remove_missing</string>
<string>form_id</string>
......@@ -259,6 +262,7 @@ return context.Base_redirect(form_id,\n
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>1</int>
<int>0</int>
<int>0</int>
<string>view</string>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -103,6 +100,7 @@
<list>
<string>your_category</string>
<string>your_section_id</string>
<string>your_depth</string>
<string>your_update_existing</string>
<string>your_remove_missing</string>
</list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="IntegerField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_depth</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>
<item>
<key> <string>integer_out_of_range</string> </key>
<value> <string>The integer you entered was out of range.</string> </value>
</item>
<item>
<key> <string>not_integer</string> </key>
<value> <string>You did not enter an integer.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>end</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>end</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>end</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Depth</string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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