Commit 5cb85ff9 authored by Yoshinori Okuji's avatar Yoshinori Okuji

2008-06-11 yo

* Make WebSection_getPermanentURL consistent.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21486 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9c070c26
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -106,19 +103,25 @@
- change the behaviour of WebSection_getPermanentURL\n
for documents which are not published.\n
"""\n
# If no reference is defined, no way to build a permanent URL.\n
reference = document.getReference()\n
if not reference:\n
return document.absolute_url()\n
\n
# Return absolute URL if this is not an appropriate portal_type\n
valid_portal_type_list = [\'Web Page\', ] # WARNING - this is a copy from WebSection_getDocumentValue\n
portal = context.getPortalObject()\n
valid_portal_type_list = portal.getPortalDocumentTypeList()\n
if document.getPortalType() not in valid_portal_type_list:\n
return document.absolute_url()\n
\n
# Return absolute URL if this is not a \'live\' document\n
validation_state = [\'draft\', \'submitted\', \'shared\', # WARNING - this is a copy from WebSection_getDocumentValueList\n
\'released\', \'published\', \'restricted\']\n
if not document.getReference() or document.getValidationState() not in validation_state:\n
validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n
\'shared\', \'shared_alive\', \'public\', \'validated\')\n
if document.getValidationState() not in validation_state:\n
return document.absolute_url()\n
\n
# Return the URL\n
return "%s/%s" % (context.absolute_url(), document.getReference())\n
return "%s/%s" % (context.absolute_url(), reference)\n
</string> </value>
</item>
<item>
......@@ -168,10 +171,12 @@ return "%s/%s" % (context.absolute_url(), document.getReference())\n
<value>
<tuple>
<string>document</string>
<string>valid_portal_type_list</string>
<string>_getattr_</string>
<string>validation_state</string>
<string>reference</string>
<string>context</string>
<string>portal</string>
<string>valid_portal_type_list</string>
<string>validation_state</string>
</tuple>
</value>
</item>
......
2008-06-11 yo
* Make WebSection_getPermanentURL consistent.
2008-06-11 yo
* Make the scripts for retrieving documents more consistent.
......
641
\ No newline at end of file
642
\ 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