Commit ba676a11 authored by Kevin Deldycke's avatar Kevin Deldycke

Minor code layout changes.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10200 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2a414284
...@@ -72,11 +72,14 @@ ...@@ -72,11 +72,14 @@
"""\n """\n
Short description:\n Short description:\n
\n
This script is able to aggregate form groups automaticcaly, according our own\n This script is able to aggregate form groups automaticcaly, according our own\n
rules. This is required to do custom xhtml layout for which a flat rendering\n rules. This is required to do custom xhtml layout for which a flat rendering\n
of groups doesn\'t work.\n of groups doesn\'t work.\n
\n \n
\n
Detailed description:\n Detailed description:\n
\n
Actually, without this script, fields groups of the ERP5 form used for layout\n Actually, without this script, fields groups of the ERP5 form used for layout\n
are rendered in a flat way like this:\n are rendered in a flat way like this:\n
\n \n
...@@ -125,6 +128,7 @@ Detailed description:\n ...@@ -125,6 +128,7 @@ Detailed description:\n
\n \n
\n \n
Rules:\n Rules:\n
\n
1 - If the group id don\'t match any group_by_criterion string, the group will\n 1 - If the group id don\'t match any group_by_criterion string, the group will\n
be added in the last aggregate (see \'footer\' group in exemple below).\n be added in the last aggregate (see \'footer\' group in exemple below).\n
2 - A group can\'t be in two differrent aggregate (no duplicate).\n 2 - A group can\'t be in two differrent aggregate (no duplicate).\n
...@@ -164,23 +168,28 @@ Example:\n ...@@ -164,23 +168,28 @@ Example:\n
[ [\'left\', [ (\'left column\', \'left column\', \'left column\')\n [ [\'left\', [ (\'left column\', \'left column\', \'left column\')\n
, (\'left ad\', \'left ad\', \'left ad\')\n , (\'left ad\', \'left ad\', \'left ad\')\n
, (\'left discount\', \'Discount on Right Handed Tools\', \'(Discount on Right Handed Tools) left discount\')\n , (\'left discount\', \'Discount on Right Handed Tools\', \'(Discount on Right Handed Tools) left discount\')\n
]]\n ]]\n
, [\'right\', [ (\'metadata right\', \'metadata right\', \'metadata right\')\n , [\'right\', [ (\'metadata right\', \'metadata right\', \'metadata right\')\n
, (\'right ad\', \'right ad\', \'right ad\')\n , (\'right ad\', \'right ad\', \'right ad\')\n
]]\n ]]\n
, [\'center\', [\n , [\'center\', [\n
]]\n ]]\n
, [\'bottom\', [ (\'bottom content\', \'bottom content\', \'bottom content\')\n , [\'bottom\', [ (\'bottom content\', \'bottom content\', \'bottom content\')\n
, (\'footer\', \'footer\', \'footer\')\n , (\'footer\', \'footer\', \'footer\')\n
, (\'bottom right\', \'bottom right\', \'bottom right\')\n , (\'bottom right\', \'bottom right\', \'bottom right\')\n
]]\n ]]\n
]\n ]\n
\n
\n \n
Tips:\n Tips:\n
* The returned list structure is design to let you cast them as dict() if you don\'t care about group aggregate ordering. This also help you to get group aggregate more easily\n \n
* The returned list structure is design to let you cast it as dict() if you don\'t\n
care about group aggregate ordering. This also help you to get group aggregate\n
more easily.\n
\n \n
"""\n """\n
\n \n
\n
aggregate_list = [] # Returned data structure\n aggregate_list = [] # Returned data structure\n
\n \n
if not len(group_by_criterion):\n if not len(group_by_criterion):\n
...@@ -219,13 +228,13 @@ for group_id in layout_form.get_groups(include_empty=0): # ...@@ -219,13 +228,13 @@ for group_id in layout_form.get_groups(include_empty=0): #
\n \n
\n \n
# Reorder the list # Rule (3)\n # Reorder the list # Rule (3)\n
aggregate_list = []\n
for criterion in group_by_criterion:\n for criterion in group_by_criterion:\n
aggregate = [ criterion\n aggregate = [ criterion\n
, aggregate_dict[criterion]\n , aggregate_dict[criterion]\n
]\n ]\n
aggregate_list.append(aggregate)\n aggregate_list.append(aggregate)\n
\n \n
\n
return aggregate_list\n return aggregate_list\n
......
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