Commit 5b0ec46f authored by Fabien Morin's avatar Fabien Morin

add a script WebSection_getPermanentURLView and use it when it's necessary.

Since r30523, all url returned by WebSection_getPermanentURL will not contain "/view", but in some case we need it.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30525 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent acc72dee
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
return permanent url with "/view" add the end of the url for all portal_type\n
different from Web Page (Web Page can be displayed without "/view" and it\'s\n
better for cache).\n
"""\n
permanent_url = context.WebSection_getPermanentURL(document)\n
if portal_type == \'Web Page\':\n
return permanent_url\n
else:\n
return "%s/view" % permanent_url\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>document</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>document</string>
<string>_getattr_</string>
<string>context</string>
<string>permanent_url</string>
<string>portal_type</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getPermanentURLView</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -115,7 +115,7 @@ def getSiteMapItemTree(section, depth=0, level=None): \n ...@@ -115,7 +115,7 @@ def getSiteMapItemTree(section, depth=0, level=None): \n
if include_document or (include_document is None and section.isSiteMapDocumentParent()):\n if include_document or (include_document is None and section.isSiteMapDocumentParent()):\n
for document in section.getDocumentValueList(sort_on=\'title\'):\n for document in section.getDocumentValueList(sort_on=\'title\'):\n
result.append({\n result.append({\n
\'url\' : section.getPermanentURL(document),\n \'url\' : section.WebSection_getPermanentURLView(document),\n
\'level\' : level,\n \'level\' : level,\n
\'section\' : None,\n \'section\' : None,\n
\'document\' : document,\n \'document\' : document,\n
......
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getPermanentURL(cell)</string> </value> <value> <string>python:cell.WebSection_getPermanentURLView(cell)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</tal:block>\n </tal:block>\n
\n \n
<ul tal:repeat="document python:here.getDocumentValueList()">\n <ul tal:repeat="document python:here.getDocumentValueList()">\n
<li><a tal:attributes="href python:here.getPermanentURL(document)"\n <li><a tal:attributes="href python:here.WebSection_getPermanentURLView(document)"\n
tal:content="python: document.getProperty(\'translated_short_title\', None)\n tal:content="python: document.getProperty(\'translated_short_title\', None)\n
or document.getTranslatedTitleOrId()"/></li>\n or document.getTranslatedTitleOrId()"/></li>\n
</ul>\n </ul>\n
......
868 869
\ 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