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
**kw)\n
\n
if len(web_page_list) == 0:\n
name_without_web_site = \'-\'.join(name.split(\'-\')[:-1])+\'%\'\n
# Search again without the website\n
web_page_list = portal_catalog(reference=name_without_web_site,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
name_without_web_site = \'-\'.join(name.split(\'-\')[:-1])\n
if name_without_web_site:\n
name_without_web_site += \'%\'\n
# Search again without the website\n
web_page_list = portal_catalog(reference=name_without_web_site,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n
if len(web_page_list) == 0:\n
name_without_portal_type = \'%\'+\'-\'.join(name.split(\'-\')[1:])\n
# Search again without the portal_type\n
web_page_list = portal_catalog(reference=name_without_portal_type,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
name_without_portal_type = \'-\'.join(name.split(\'-\')[1:])\n
if name_without_portal_type:\n
name_without_portal_type = \'%\'+name_without_portal_type\n
# Search again without the portal_type\n
web_page_list = portal_catalog(reference=name_without_portal_type,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n
if len(web_page_list) == 0:\n
name_without_portal_type_and_web_site = \'%\'+\'-\'.join(name.split(\'-\')[1:-1])+\'%\'\n
# Search again without the portal_type and web_site\n
web_page_list = portal_catalog(reference=name_without_portal_type_and_web_site,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
name_without_portal_type_and_web_site = \'-\'.join(name.split(\'-\')[1:-1])\n
if name_without_portal_type_and_web_site:\n
name_without_portal_type_and_web_site = \'%\'+name_without_portal_type_and_web_site+\'%\'\n
# Search again without the portal_type and web_site\n
web_page_list = portal_catalog(reference=name_without_portal_type_and_web_site,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n
if len(web_page_list) == 0:\n
name_without_web_site_and_view = \'-\'.join(name.split(\'-\')[:-2])+\'%\'\n
# Search again without the portal_type and view\n
web_page_list = portal_catalog(reference=name_without_web_site_and_view,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
name_without_web_site_and_view = \'-\'.join(name.split(\'-\')[:-2])\n
if name_without_web_site_and_view:\n
name_without_web_site_and_view += \'%\'\n
# Search again without the portal_type and view\n
web_page_list = portal_catalog(reference=name_without_web_site_and_view,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n
if len(web_page_list) == 0:\n
state = \'%\'+name.split(\'-\')[1]+\'%\'\n
# Search only with state\n
web_page_list = portal_catalog(reference=state,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
state = name.split(\'-\')[1]\n
if state:\n
state = \'%\' + state + \'%\'\n
# Search only with state\n
web_page_list = portal_catalog(reference=state,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
limit=1,\n
**kw)\n
\n
if len(web_page_list) == 0:\n
# Default returns None\n
......@@ -236,6 +246,7 @@ return web_page\n
<string>len</string>
<string>_getitem_</string>
<string>name_without_web_site</string>
<string>_inplacevar_</string>
<string>name_without_portal_type</string>
<string>name_without_portal_type_and_web_site</string>
<string>name_without_web_site_and_view</string>
......
305
\ No newline at end of file
306
\ 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