Commit 65dde4a1 authored by Jérome Perrin's avatar Jérome Perrin

km: use context free document lookup in "document renderer"

This gadget looks up a document by reference, by using
getDocumentValueList on the context of the web section.
getDocumentValueList also applies the criterions from the context, but
because web page references are already unique, adding more criterions
can just cause the document to be not found and the gadget to display
the "No document" error.
parent e489380e
...@@ -8,7 +8,7 @@ if box_relative_url: ...@@ -8,7 +8,7 @@ if box_relative_url:
preferences = box.KnowledgeBox_getDefaultPreferencesDict() preferences = box.KnowledgeBox_getDefaultPreferencesDict()
reference=preferences.get('preferred_document_reference', None) reference=preferences.get('preferred_document_reference', None)
if reference is not None: if reference is not None:
web_page_list = context.getDocumentValueList(reference=reference, all_languages=True, web_page_list = portal.portal_catalog.getDocumentValueList(reference=reference, all_languages=True,
portal_type='Web Page') portal_type='Web Page')
if len(web_page_list): if len(web_page_list):
return '<div class="web-page-renderer">%s</div>' %web_page_list[0].getObject().asStrippedHTML() return '<div class="web-page-renderer">%s</div>' %web_page_list[0].getObject().asStrippedHTML()
......
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