Commit 8439cd54 authored by Yoshinori Okuji's avatar Yoshinori Okuji

2008-05-21 yo

* Try an English version if no document is found for a given language.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21071 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dae35479
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -110,23 +107,28 @@ web_page_list = portal_catalog(reference=name, portal_type=valid_portal_type_lis ...@@ -110,23 +107,28 @@ web_page_list = portal_catalog(reference=name, portal_type=valid_portal_type_lis
group_by=(\'reference\',),\n group_by=(\'reference\',),\n
**kw)\n **kw)\n
\n \n
try:\n if len(web_page_list) == 0 and language != \'en\':\n
# Try to get the first page on the list\n # Search again with English as a fallback.\n
web_page = web_page_list[0]\n web_page_list = portal_catalog(reference=name, portal_type=valid_portal_type_list,\n
web_page = web_page.getObject()\n language=\'en\',\n
except IndexError:\n order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
**kw)\n
\n
if len(web_page_list) == 0:\n
# Search again without the language\n # Search again without the language\n
web_page_list = portal_catalog(reference=name, portal_type=\'Web Page\', \n web_page_list = portal_catalog(reference=name, portal_type=\'Web Page\', \n
order_by=[(\'version\', \'descending\')],\n order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n group_by=(\'reference\',),\n
**kw)\n **kw)\n
try:\n \n
# Try to get the first page on the list\n if len(web_page_list) == 0:\n
web_page = web_page_list[0]\n # Default returns None\n
web_page = web_page.getObject()\n web_page = None\n
except IndexError:\n else:\n
# Default returns None\n # Try to get the first page on the list\n
web_page = None\n web_page = web_page_list[0]\n
web_page = web_page.getObject()\n
\n \n
# return the web page\n # return the web page\n
return web_page\n return web_page\n
...@@ -191,8 +193,8 @@ return web_page\n ...@@ -191,8 +193,8 @@ return web_page\n
<string>_write_</string> <string>_write_</string>
<string>_apply_</string> <string>_apply_</string>
<string>web_page_list</string> <string>web_page_list</string>
<string>len</string>
<string>web_page</string> <string>web_page</string>
<string>IndexError</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
2008-05-21 yo
* Try an English version if no document is found for a given language.
2008-4-17 yusei 2008-4-17 yusei
* Revise version to 5.0. * Revise version to 5.0.
......
630 631
\ 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