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 @@ ...@@ -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>
...@@ -106,19 +103,25 @@ ...@@ -106,19 +103,25 @@
- 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
# 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 # 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 if document.getPortalType() not in valid_portal_type_list:\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 = [\'draft\', \'submitted\', \'shared\', # WARNING - this is a copy from WebSection_getDocumentValueList\n validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n
\'released\', \'published\', \'restricted\']\n \'shared\', \'shared_alive\', \'public\', \'validated\')\n
if not document.getReference() or document.getValidationState() not in validation_state:\n if document.getValidationState() not in validation_state:\n
return document.absolute_url()\n return document.absolute_url()\n
\n \n
# Return the URL\n # Return the URL\n
return "%s/%s" % (context.absolute_url(), document.getReference())\n return "%s/%s" % (context.absolute_url(), reference)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -168,10 +171,12 @@ return "%s/%s" % (context.absolute_url(), document.getReference())\n ...@@ -168,10 +171,12 @@ return "%s/%s" % (context.absolute_url(), document.getReference())\n
<value> <value>
<tuple> <tuple>
<string>document</string> <string>document</string>
<string>valid_portal_type_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>validation_state</string> <string>reference</string>
<string>context</string> <string>context</string>
<string>portal</string>
<string>valid_portal_type_list</string>
<string>validation_state</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
2008-06-11 yo
* Make WebSection_getPermanentURL consistent.
2008-06-11 yo 2008-06-11 yo
* Make the scripts for retrieving documents more consistent. * Make the scripts for retrieving documents more consistent.
......
641 642
\ 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