Commit 52e2fb94 authored by Fabien Morin's avatar Fabien Morin

check that the modified name is not none. This improve a lot the perf....

check that the modified name is not none. This improve a lot the perf. Previously this mistake make some pages to take 3 minutes to be totally loaded. Now it's about one second or less.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23632 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 93f4786c
...@@ -121,59 +121,69 @@ if len(web_page_list) == 0:\n ...@@ -121,59 +121,69 @@ if len(web_page_list) == 0:\n
**kw)\n **kw)\n
\n \n
if len(web_page_list) == 0:\n if len(web_page_list) == 0:\n
name_without_web_site = \'-\'.join(name.split(\'-\')[:-1])+\'%\'\n name_without_web_site = \'-\'.join(name.split(\'-\')[:-1])\n
# Search again without the website\n if name_without_web_site:\n
web_page_list = portal_catalog(reference=name_without_web_site,\n name_without_web_site += \'%\'\n
portal_type=valid_portal_type_list,\n # Search again without the website\n
validation_state=validation_state,\n web_page_list = portal_catalog(reference=name_without_web_site,\n
order_by=[(\'version\', \'descending\')],\n portal_type=valid_portal_type_list,\n
group_by=(\'reference\',),\n validation_state=validation_state,\n
limit=1,\n order_by=[(\'version\', \'descending\')],\n
**kw)\n group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n \n
if len(web_page_list) == 0:\n if len(web_page_list) == 0:\n
name_without_portal_type = \'%\'+\'-\'.join(name.split(\'-\')[1:])\n name_without_portal_type = \'-\'.join(name.split(\'-\')[1:])\n
# Search again without the portal_type\n if name_without_portal_type:\n
web_page_list = portal_catalog(reference=name_without_portal_type,\n name_without_portal_type = \'%\'+name_without_portal_type\n
portal_type=valid_portal_type_list,\n # Search again without the portal_type\n
validation_state=validation_state,\n web_page_list = portal_catalog(reference=name_without_portal_type,\n
order_by=[(\'version\', \'descending\')],\n portal_type=valid_portal_type_list,\n
group_by=(\'reference\',),\n validation_state=validation_state,\n
limit=1,\n order_by=[(\'version\', \'descending\')],\n
**kw)\n group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n \n
if len(web_page_list) == 0:\n if len(web_page_list) == 0:\n
name_without_portal_type_and_web_site = \'%\'+\'-\'.join(name.split(\'-\')[1:-1])+\'%\'\n name_without_portal_type_and_web_site = \'-\'.join(name.split(\'-\')[1:-1])\n
# Search again without the portal_type and web_site\n if name_without_portal_type_and_web_site:\n
web_page_list = portal_catalog(reference=name_without_portal_type_and_web_site,\n name_without_portal_type_and_web_site = \'%\'+name_without_portal_type_and_web_site+\'%\'\n
portal_type=valid_portal_type_list,\n # Search again without the portal_type and web_site\n
validation_state=validation_state,\n web_page_list = portal_catalog(reference=name_without_portal_type_and_web_site,\n
order_by=[(\'version\', \'descending\')],\n portal_type=valid_portal_type_list,\n
group_by=(\'reference\',),\n validation_state=validation_state,\n
limit=1,\n order_by=[(\'version\', \'descending\')],\n
**kw)\n group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n \n
if len(web_page_list) == 0:\n if len(web_page_list) == 0:\n
name_without_web_site_and_view = \'-\'.join(name.split(\'-\')[:-2])+\'%\'\n name_without_web_site_and_view = \'-\'.join(name.split(\'-\')[:-2])\n
# Search again without the portal_type and view\n if name_without_web_site_and_view:\n
web_page_list = portal_catalog(reference=name_without_web_site_and_view,\n name_without_web_site_and_view += \'%\'\n
portal_type=valid_portal_type_list,\n # Search again without the portal_type and view\n
validation_state=validation_state,\n web_page_list = portal_catalog(reference=name_without_web_site_and_view,\n
order_by=[(\'version\', \'descending\')],\n portal_type=valid_portal_type_list,\n
group_by=(\'reference\',),\n validation_state=validation_state,\n
limit=1,\n order_by=[(\'version\', \'descending\')],\n
**kw)\n group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n \n
if len(web_page_list) == 0:\n if len(web_page_list) == 0:\n
state = \'%\'+name.split(\'-\')[1]+\'%\'\n state = name.split(\'-\')[1]\n
# Search only with state\n if state:\n
web_page_list = portal_catalog(reference=state,\n state = \'%\' + state + \'%\'\n
portal_type=valid_portal_type_list,\n # Search only with state\n
validation_state=validation_state,\n web_page_list = portal_catalog(reference=state,\n
order_by=[(\'version\', \'descending\')],\n portal_type=valid_portal_type_list,\n
group_by=(\'reference\',),\n validation_state=validation_state,\n
limit=1,\n order_by=[(\'version\', \'descending\')],\n
**kw)\n group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n \n
if len(web_page_list) == 0:\n if len(web_page_list) == 0:\n
# Default returns None\n # Default returns None\n
...@@ -236,6 +246,7 @@ return web_page\n ...@@ -236,6 +246,7 @@ return web_page\n
<string>len</string> <string>len</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>name_without_web_site</string> <string>name_without_web_site</string>
<string>_inplacevar_</string>
<string>name_without_portal_type</string> <string>name_without_portal_type</string>
<string>name_without_portal_type_and_web_site</string> <string>name_without_portal_type_and_web_site</string>
<string>name_without_web_site_and_view</string> <string>name_without_web_site_and_view</string>
......
305 306
\ 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