Commit 36c5b833 authored by Jérome Perrin's avatar Jérome Perrin

web_renderjs_ui: use context-free getDocumentValueList for reference lookups

When looking up a document by reference, using getDocumentValueList from
the context of a web site / web section might not find the documents,
depending on the predicates defined on the web site / web section.
parent 65dde4a1
Pipeline #26194 passed with stage
in 0 seconds
......@@ -11,7 +11,7 @@ if appcache_reference:
appcache_manifest_modification_date = appcache_manifest.getObject().getModificationDate()
if url_list:
for referenced_document in context.getDocumentValueList(reference=url_list):
for referenced_document in context.getPortalObject().portal_catalog.getDocumentValueList(reference=url_list):
if referenced_document.getModificationDate() > appcache_manifest_modification_date:
error_list.append(
"Document {} is newer than cache manifest".format(referenced_document.getReference()))
......
......@@ -18,7 +18,7 @@ web_page_by_reference = {}
if web_page_reference_list:
web_page_list = [
b.getObject() for b in
context.getDocumentValueList(reference=web_page_reference_list)]
portal.portal_catalog.getDocumentValueList(reference=web_page_reference_list)]
  • @jerome I see the justification of this change. However, I see that if I am in a context of Web Site for which Default Language = fr then Web Pages that have language en are not found. We could change our Web Pages to have language fr, but what if we use other from generic that have en ?

    So I think we could add here all_languages=True, would you agree?

    Maybe also above in the WebSite_checkCacheModificationDateConsistency case, but I have not thought of this much

    @valentin this should be the reason for the strange behaviour you got

  • I don't fully remember (and I don't feel I understand the magics of erp5_web generally speaking), but that seems to make sense. One idea of this change was to have search parameters matching more documents. I did not consider the case of multiple languages.

  • OK, thanks, I pushed in 3b017fb0

  • Don't you think we can do the same change in the two scripts modified in this commit ?

  • bah, I forgot it... there we want again to check consistency for as many documents as possible I suppose

    By the way, is it still used? I think we turned to Service Worker now so that old mechanism is deprecated. Or maybe used in projects?

  • Thanks, I also believe it's the same, but that's a good point that appcache is deprecated. If this is what I think it is, we should probably just remove it, Web browsers no longer support this so I don't see who can still depend on this.

  • @romain , what do you think about dropping appcache related code?

    (EDIT: typo)

    Edited by Georgios Dagkakis
  • Feel free to drop appcache related code. It was dropped from the html5 specifications.

Please register or sign in to reply
web_page_by_reference = {wp.getReference(): wp.getTextContent() for wp in web_page_list}
for web_page_reference in web_page_reference_list:
......
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