Commit b63261d4 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

we no longer need '/view' in the permanent url.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40359 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 17c3b0c7
...@@ -77,9 +77,6 @@ ...@@ -77,9 +77,6 @@
document reference.\n document reference.\n
\n \n
The document parameter is required.\n The document parameter is required.\n
\n
If view is True, the url returned point to html content and can be opened in\n
a browser (ie. + \'/view\' for ooo documents)\n
\n \n
More sophisticated behaviours are possible.\n More sophisticated behaviours are possible.\n
\n \n
...@@ -91,14 +88,11 @@ ...@@ -91,14 +88,11 @@
- change the behaviour of WebSection_getPermanentURL\n - change the behaviour of WebSection_getPermanentURL\n
for documents which are not published.\n for documents which are not published.\n
"""\n """\n
html_portal_type_list = (\'Web Site\', \'Web Section\', \'Web Page\')\n
portal_type = document.getPortalType()\n portal_type = document.getPortalType()\n
\n \n
# If no reference is defined, no way to build a permanent URL.\n # If no reference is defined, no way to build a permanent URL.\n
reference = document.getReference()\n reference = document.getReference()\n
if not reference:\n if not reference:\n
if view and portal_type not in html_portal_type_list:\n
return \'%s/view\' % document.absolute_url()\n
return document.absolute_url()\n return document.absolute_url()\n
\n \n
# Return absolute URL if this is not an appropriate portal_type\n # Return absolute URL if this is not an appropriate portal_type\n
...@@ -106,23 +100,15 @@ portal = context.getPortalObject()\n ...@@ -106,23 +100,15 @@ portal = context.getPortalObject()\n
valid_portal_type_list = portal.getPortalDocumentTypeList()\n valid_portal_type_list = portal.getPortalDocumentTypeList()\n
portal_type = document.getPortalType()\n portal_type = document.getPortalType()\n
if portal_type not in valid_portal_type_list:\n if portal_type not in valid_portal_type_list:\n
\n
if view and portal_type not in html_portal_type_list:\n
return \'%s/view\' % document.absolute_url()\n
return document.absolute_url()\n return document.absolute_url()\n
\n \n
# Return absolute URL if this is not a \'live\' document\n # Return absolute URL if this is not a \'live\' document\n
validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n
\'shared\', \'shared_alive\', \'public\', \'validated\')\n \'shared\', \'shared_alive\', \'public\', \'validated\')\n
if document.getValidationState() not in validation_state:\n if document.getValidationState() not in validation_state:\n
if view and portal_type not in html_portal_type_list:\n
return \'%s/view\' % document.absolute_url()\n
return document.absolute_url()\n return document.absolute_url()\n
\n \n
# Return the URL\n # Return the URL\n
if view and portal_type not in html_portal_type_list:\n
return \'%s/%s/view\' % (context.absolute_url(), reference)\n
\n
web_section = context.getWebSectionValue()\n web_section = context.getWebSectionValue()\n
if web_section is None:\n if web_section is None:\n
web_section = context\n web_section = context\n
...@@ -165,7 +151,6 @@ return "%s/%s" % (web_section.absolute_url(), reference)\n ...@@ -165,7 +151,6 @@ return "%s/%s" % (web_section.absolute_url(), reference)\n
<tuple> <tuple>
<string>document</string> <string>document</string>
<string>view</string> <string>view</string>
<string>html_portal_type_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>portal_type</string> <string>portal_type</string>
<string>reference</string> <string>reference</string>
......
1002 1003
\ 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