Commit 3121406a authored by Kevin Deldycke's avatar Kevin Deldycke

(Stefan) WebSite_getDocumentValue is now be able to display any object with a refernce property.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9568 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 55213cf7
...@@ -88,8 +88,7 @@ ...@@ -88,8 +88,7 @@
#\n #\n
# NOTE: portal param probably useless\n # NOTE: portal param probably useless\n
\n \n
\n portal_catalog = portal.portal_catalog\n
portal_catalog = container.portal_catalog\n
\n \n
if name is None:\n if name is None:\n
if context.getPortalType() == \'Web Page\':\n if context.getPortalType() == \'Web Page\':\n
...@@ -99,16 +98,20 @@ if name is None:\n ...@@ -99,16 +98,20 @@ if name is None:\n
else:\n else:\n
return None\n return None\n
\n \n
#"else:" (mostly code from the old implementation)\n #If name is not None, it has to be searched for it in the catalog.\n
\n \n
#from Products.ERP5Type.Cache import CachingMethod\n #from Products.ERP5Type.Cache import CachingMethod\n
def getDocument(name):\n def getDocument(name):\n
# First try to get a published document\n # First try to get a published document\n
matching_document_list = portal_catalog(reference = \'%s\' % name, portal_type=(\'Web Page\',), validation_state=\'published\')\n matching_document_list = portal_catalog(reference = \'%s\' % name, validation_state=\'published\')\n
if len(matching_document_list):\n
return matching_document_list[0].getObject()\n
# Then try to get a validated document (Product)\n
matching_document_list = portal_catalog(reference = \'%s\' % name, validation_state=\'validated\')\n
if len(matching_document_list):\n if len(matching_document_list):\n
return matching_document_list[0].getObject()\n return matching_document_list[0].getObject()\n
# Then try to get any document\n # Then try to get any document\n
matching_document_list = portal_catalog(reference = \'%s\' % name, portal_type=(\'Web Page\',))\n matching_document_list = portal_catalog(reference = \'%s\' % name)\n
if len(matching_document_list):\n if len(matching_document_list):\n
return matching_document_list[0].getObject()\n return matching_document_list[0].getObject()\n
return None \n return None \n
...@@ -136,7 +139,7 @@ return getDocument(name)\n ...@@ -136,7 +139,7 @@ return getDocument(name)\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>portal=None, name=None</string> </value> <value> <string>portal, name=None</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -165,7 +168,6 @@ return getDocument(name)\n ...@@ -165,7 +168,6 @@ return getDocument(name)\n
<string>portal</string> <string>portal</string>
<string>name</string> <string>name</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>container</string>
<string>portal_catalog</string> <string>portal_catalog</string>
<string>None</string> <string>None</string>
<string>context</string> <string>context</string>
...@@ -183,7 +185,6 @@ return getDocument(name)\n ...@@ -183,7 +185,6 @@ return getDocument(name)\n
<value> <value>
<tuple> <tuple>
<none/> <none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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