Commit 089ed5a2 authored by Fabien Morin's avatar Fabien Morin

2009-01-07 fabien

* update some scripts used to generate domain to display planningbox. This permit to increase the speed of the page displaying (about 3 time faster in my tests)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25033 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 74afb141
...@@ -53,26 +53,37 @@ ...@@ -53,26 +53,37 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n <value> <string>domain_list = []\n
domain_list = []\n
\n \n
if depth == 0:\n if depth == 0:\n
category_list = [ ]\n task_uid_list = context.portal_selections.getSelectionUidList(context=context, selection_name=\'task_module_selection\')\n
for i in context.portal_selections.getSelectionValueList(context=context,\n person_result = context.portal_catalog(portal_type=["Person",],\n
selection_name= \'task_module_selection\'):\n source_related_uid=task_uid_list,\n
category_list.extend([j for j in i.getSourceValueList() if j not in category_list])\n select_expression=\'catalog.portal_type, catalog.relative_url, catalog.id, catalog.title\',\n
\n sort_on = ((\'title\',\'ascending\'),))\n
\n person_dict = {}\n
person_list = []\n
append = person_list.append\n
for person in person_result:\n
key = person.uid\n
if key not in person_dict:\n
person_dict[key] = None\n
category_dict = {\'relative_url\':person.relative_url, \n
\'portal_type\':person.portal_type,\n
\'id\':person.id,\n
\'title\':person.title,\n
\'uid\':person.uid}\n
append(category_dict)\n
else:\n else:\n
return domain_list\n return domain_list\n
\n \n
for category in category_list:\n for person in person_list:\n
domain = parent.generateTempDomain(id = \'sub\' + category.getId() )\n domain = parent.generateTempDomain(id = \'sub\' + person[\'id\'] )\n
domain.edit(title = category.getTitle(),\n domain.edit(title = person[\'title\'],\n
membership_criterion_base_category = (\'source\', ), \n membership_criterion_base_category = (\'source\', ), \n
membership_criterion_category = (category.getRelativeUrl(),),\n membership_criterion_category = (person[\'relative_url\'],),\n
domain_generator_method_id = script.id,\n domain_generator_method_id = script.id,\n
uid = category.getUid())\n uid = person[\'uid\'])\n
\n \n
domain_list.append(domain)\n domain_list.append(domain)\n
\n \n
...@@ -116,17 +127,21 @@ return domain_list\n ...@@ -116,17 +127,21 @@ return domain_list\n
<string>depth</string> <string>depth</string>
<string>parent</string> <string>parent</string>
<string>kw</string> <string>kw</string>
<string>domain_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>task_uid_list</string>
<string>domain_list</string> <string>person_result</string>
<string>category_list</string> <string>person_dict</string>
<string>_getiter_</string> <string>person_list</string>
<string>i</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>_getiter_</string>
<string>j</string> <string>person</string>
<string>category</string> <string>key</string>
<string>None</string>
<string>_write_</string>
<string>category_dict</string>
<string>_getitem_</string>
<string>domain</string> <string>domain</string>
<string>script</string> <string>script</string>
</tuple> </tuple>
......
...@@ -53,44 +53,86 @@ ...@@ -53,44 +53,86 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n <value> <string encoding="cdata"><![CDATA[
restrictedTraverse = context.getPortalObject().restrictedTraverse\n
domain_list = []\n domain_list = []\n
\n \n
\n def Task_getRelatedSourceProject(depth, parent_relative_url=None):\n
if depth == 0:\n if depth == 0:\n
category_list = []\n task_uid_list = context.portal_selections.getSelectionUidList(context=context, selection_name=\'task_module_selection\')\n
for task in context.portal_selections.getSelectionValueList(context=context,\n project_result = context.portal_catalog(portal_type=["Project", "Project Line"],\n
selection_name=\'task_module_selection\'):\n source_project_related_uid=task_uid_list,\n
source_project_value_list = \\\n select_expression=\'catalog.portal_type, catalog.relative_url, catalog.id, catalog.title\',\n
task.getSourceProjectValueList(portal_type=["Project", "Project Line"])\n sort_on = ((\'title\',\'ascending\'),))\n
for source_project_value in source_project_value_list:\n
if source_project_value.getPortalType() == \'Project\':\n
category = source_project_value\n
else:\n else:\n
category = source_project_value.getExplanationValue()\n project_result = context.portal_catalog(portal_type=["Project Line", "Project Milestones"],\n
if category not in category_list:\n select_expression=\'catalog.portal_type, catalog.relative_url, catalog.id, catalog.title\',\n
category_list.append(category)\n parent_relative_url=parent_relative_url,\n
sort_on = ((\'title\',\'ascending\'),))\n
# use a dict to store catalog result\n
project_dict = {}\n
category_dict = {}\n
project_list = []\n
append = project_list.append\n
for x in project_result:\n
key = x.uid\n
if key not in project_dict:\n
project_dict[key] = None\n
category_dict = {\'relative_url\':x.relative_url, \n
\'portal_type\':x.portal_type,\n
\'id\':x.id,\n
\'title\':x.title,\n
\'uid\':x.uid}\n
append(category_dict)\n
\n \n
else:\n return project_list\n
\n
def Task_getRelatedSourceProjectCategory(depth):\n
parent_relative_url = None\n
if depth > 0:\n
parent_relative_url = parent.getMembershipCriterionCategoryList()\n
project_list = Task_getRelatedSourceProject(depth=depth,\n
parent_relative_url=parent_relative_url)\n
\n
category_dict = {}\n
category_list = []\n category_list = []\n
for i in context.portal_selections.getSelectionValueList(context=context,\n append = category_list.append\n
selection_name=\'task_module_selection\'):\n
category_list.extend([j for j in i.getSourceProjectValueList(portal_type=["Project Line", "Project Milestones"]) \\\n
if (j not in category_list) and (j.getParentRelativeUrl() in parent.getMembershipCriterionCategoryList())])\n
\n \n
for project in project_list:\n
if project[\'portal_type\'] == \'Project\' or depth > 0:\n
category = project\n
else:\n
# XXX here we need to get the project line object to get the explanation value\n
project_line_value = restrictedTraverse(project[\'relative_url\'])\n
explanation_value = project_line_value.getExplanationValue()\n
category = {\'relative_url\':explanation_value.getRelativeUrl(), \n
\'portal_type\':explanation_value.getPortalType(),\n
\'id\':explanation_value.getId(),\n
\'title\':explanation_value.getTitle(),\n
\'uid\':explanation_value.getUid()}\n
key = category[\'uid\']\n
if key not in category_dict:\n
category_dict[key] = None\n
append(category)\n
\n
return category_list\n
\n
category_list = Task_getRelatedSourceProjectCategory(depth)\n
\n \n
for category in category_list:\n for category in category_list:\n
domain = parent.generateTempDomain(id = \'sub\' + category.getId() )\n domain = parent.generateTempDomain(id = \'sub\' + category[\'id\'] )\n
domain.edit(title = category.getTitle(),\n domain.edit(title = category[\'title\'],\n
membership_criterion_base_category = (\'source_project\', ), \n membership_criterion_base_category = (\'source_project\', ), \n
membership_criterion_category = (category.getRelativeUrl(),),\n membership_criterion_category = (category[\'relative_url\'],),\n
domain_generator_method_id = script.id,\n domain_generator_method_id = script.id,\n
uid = category.getUid())\n uid = category[\'uid\'])\n
\n \n
domain_list.append(domain)\n domain_list.append(domain)\n
\n
return domain_list\n return domain_list\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -131,18 +173,15 @@ return domain_list\n ...@@ -131,18 +173,15 @@ return domain_list\n
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>restrictedTraverse</string>
<string>domain_list</string> <string>domain_list</string>
<string>None</string>
<string>Task_getRelatedSourceProject</string>
<string>Task_getRelatedSourceProjectCategory</string>
<string>category_list</string> <string>category_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>task</string>
<string>source_project_value_list</string>
<string>source_project_value</string>
<string>category</string> <string>category</string>
<string>i</string> <string>_getitem_</string>
<string>append</string>
<string>$append0</string>
<string>j</string>
<string>domain</string> <string>domain</string>
<string>script</string> <string>script</string>
</tuple> </tuple>
......
...@@ -53,26 +53,37 @@ ...@@ -53,26 +53,37 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n <value> <string>domain_list = []\n
domain_list = []\n
\n \n
if depth == 0:\n if depth == 0:\n
category_list = [ ]\n task_uid_list = context.portal_selections.getSelectionUidList(context=context, selection_name=\'task_report_module_selection\')\n
for i in context.portal_selections.getSelectionValueList(context=context,\n person_result = context.portal_catalog(portal_type=["Person",],\n
selection_name= \'task_report_module_selection\'):\n source_related_uid=task_uid_list,\n
category_list.extend([j for j in i.getSourceValueList() if j not in category_list])\n select_expression=\'catalog.portal_type, catalog.relative_url, catalog.id, catalog.title\',\n
\n sort_on = ((\'title\',\'ascending\'),))\n
\n person_dict = {}\n
person_list = []\n
append = person_list.append\n
for person in person_result:\n
key = person.uid\n
if key not in person_dict:\n
person_dict[key] = None\n
category_dict = {\'relative_url\':person.relative_url, \n
\'portal_type\':person.portal_type,\n
\'id\':person.id,\n
\'title\':person.title,\n
\'uid\':person.uid}\n
append(category_dict)\n
else:\n else:\n
return domain_list\n return domain_list\n
\n \n
for category in category_list:\n for person in person_list:\n
domain = parent.generateTempDomain(id = \'sub\' + category.getId() )\n domain = parent.generateTempDomain(id = \'sub\' + person[\'id\'] )\n
domain.edit(title = category.getTitle(),\n domain.edit(title = person[\'title\'],\n
membership_criterion_base_category = (\'source\', ), \n membership_criterion_base_category = (\'source\', ), \n
membership_criterion_category = (category.getRelativeUrl(),),\n membership_criterion_category = (person[\'relative_url\'],),\n
domain_generator_method_id = script.id,\n domain_generator_method_id = script.id,\n
uid = category.getUid())\n uid = person[\'uid\'])\n
\n \n
domain_list.append(domain)\n domain_list.append(domain)\n
\n \n
...@@ -116,17 +127,21 @@ return domain_list\n ...@@ -116,17 +127,21 @@ return domain_list\n
<string>depth</string> <string>depth</string>
<string>parent</string> <string>parent</string>
<string>kw</string> <string>kw</string>
<string>domain_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>task_uid_list</string>
<string>domain_list</string> <string>person_result</string>
<string>category_list</string> <string>person_dict</string>
<string>_getiter_</string> <string>person_list</string>
<string>i</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>_getiter_</string>
<string>j</string> <string>person</string>
<string>category</string> <string>key</string>
<string>None</string>
<string>_write_</string>
<string>category_dict</string>
<string>_getitem_</string>
<string>domain</string> <string>domain</string>
<string>script</string> <string>script</string>
</tuple> </tuple>
......
...@@ -53,44 +53,86 @@ ...@@ -53,44 +53,86 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n <value> <string encoding="cdata"><![CDATA[
restrictedTraverse = context.getPortalObject().restrictedTraverse\n
domain_list = []\n domain_list = []\n
\n \n
\n def Task_getRelatedSourceProject(depth, parent_relative_url=None):\n
if depth == 0:\n if depth == 0:\n
category_list = []\n task_uid_list = context.portal_selections.getSelectionUidList(context=context, selection_name=\'task_report_module_selection\')\n
for task in context.portal_selections.getSelectionValueList(context=context,\n project_result = context.portal_catalog(portal_type=["Project", "Project Line"],\n
selection_name=\'task_report_module_selection\'):\n source_project_related_uid=task_uid_list,\n
source_project_value_list = \\\n select_expression=\'catalog.portal_type, catalog.relative_url, catalog.id, catalog.title\',\n
task.getSourceProjectValueList(portal_type=["Project", "Project Line"])\n sort_on = ((\'title\',\'ascending\'),))\n
for source_project_value in source_project_value_list:\n
if source_project_value.getPortalType() == \'Project\':\n
category = source_project_value\n
else:\n else:\n
category = source_project_value.getExplanationValue()\n project_result = context.portal_catalog(portal_type=["Project Line", "Project Milestones"],\n
if category not in category_list:\n select_expression=\'catalog.portal_type, catalog.relative_url, catalog.id, catalog.title\',\n
category_list.append(category)\n parent_relative_url=parent_relative_url,\n
sort_on = ((\'title\',\'ascending\'),))\n
# use a dict to store catalog result\n
project_dict = {}\n
category_dict = {}\n
project_list = []\n
append = project_list.append\n
for x in project_result:\n
key = x.uid\n
if key not in project_dict:\n
project_dict[key] = None\n
category_dict = {\'relative_url\':x.relative_url, \n
\'portal_type\':x.portal_type,\n
\'id\':x.id,\n
\'title\':x.title,\n
\'uid\':x.uid}\n
append(category_dict)\n
\n \n
else:\n return project_list\n
\n
def Task_getRelatedSourceProjectCategory(depth):\n
parent_relative_url = None\n
if depth > 0:\n
parent_relative_url = parent.getMembershipCriterionCategoryList()\n
project_list = Task_getRelatedSourceProject(depth=depth,\n
parent_relative_url=parent_relative_url)\n
\n
category_dict = {}\n
category_list = []\n category_list = []\n
for i in context.portal_selections.getSelectionValueList(context=context,\n append = category_list.append\n
selection_name=\'task_report_module_selection\'):\n
category_list.extend([j for j in i.getSourceProjectValueList(portal_type=["Project Line", "Project Milestones"]) \\\n
if (j not in category_list) and (j.getParentRelativeUrl() in parent.getMembershipCriterionCategoryList())])\n
\n \n
for project in project_list:\n
if project[\'portal_type\'] == \'Project\' or depth > 0:\n
category = project\n
else:\n
# XXX here we need to get the project line object to get the explanation value\n
project_line_value = restrictedTraverse(project[\'relative_url\'])\n
explanation_value = project_line_value.getExplanationValue()\n
category = {\'relative_url\':explanation_value.getRelativeUrl(), \n
\'portal_type\':explanation_value.getPortalType(),\n
\'id\':explanation_value.getId(),\n
\'title\':explanation_value.getTitle(),\n
\'uid\':explanation_value.getUid()}\n
key = category[\'uid\']\n
if key not in category_dict:\n
category_dict[key] = None\n
append(category)\n
\n
return category_list\n
\n
category_list = Task_getRelatedSourceProjectCategory(depth)\n
\n \n
for category in category_list:\n for category in category_list:\n
domain = parent.generateTempDomain(id = \'sub\' + category.getId() )\n domain = parent.generateTempDomain(id = \'sub\' + category[\'id\'] )\n
domain.edit(title = category.getTitle(),\n domain.edit(title = category[\'title\'],\n
membership_criterion_base_category = (\'source_project\', ), \n membership_criterion_base_category = (\'source_project\', ), \n
membership_criterion_category = (category.getRelativeUrl(),),\n membership_criterion_category = (category[\'relative_url\'],),\n
domain_generator_method_id = script.id,\n domain_generator_method_id = script.id,\n
uid = category.getUid())\n uid = category[\'uid\'])\n
\n \n
domain_list.append(domain)\n domain_list.append(domain)\n
\n
return domain_list\n return domain_list\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -131,18 +173,15 @@ return domain_list\n ...@@ -131,18 +173,15 @@ return domain_list\n
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>restrictedTraverse</string>
<string>domain_list</string> <string>domain_list</string>
<string>None</string>
<string>Task_getRelatedSourceProject</string>
<string>Task_getRelatedSourceProjectCategory</string>
<string>category_list</string> <string>category_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>task</string>
<string>source_project_value_list</string>
<string>source_project_value</string>
<string>category</string> <string>category</string>
<string>i</string> <string>_getitem_</string>
<string>append</string>
<string>$append0</string>
<string>j</string>
<string>domain</string> <string>domain</string>
<string>script</string> <string>script</string>
</tuple> </tuple>
......
2009-01-07 fabien
* update some scripts used to generate domain to display planningbox. This permit to increase the speed of the page displaying (about 3 time faster in my tests)
2008-10-07 yusei 2008-10-07 yusei
* Update field titles for translation. * Update field titles for translation.
......
618 621
\ No newline at end of file \ 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