Repository: plone/Products.CMFPlone

Issue:
HTML filtering requires a "re save" on each page for the settings to take effect. 
Using:  Plone 5.0b4.dev0 (5007)

Been testing the HTML filtering settings using iFrame video. 
When I add an "iframe" video the saved page does not show the video (as expected). But when I toggle ON the "Disable HTML Filtering" checkbox the video still does not display on the page (even after emptying cache). If I edit the video page and immediately "Save" (making no edits) the video displays as expected. The reverse is also true. If I have video correctly displaying on the page (with html filtering disabled) and uncheck "Disable HTML Filtering" checkbox in the HTML Filtering panel, go back to the video page and reload the video still displays. If I edit the page and immediately save the page the video properly does not display. Is this the expected behavior?

In addition. If I add "iFrame" to the "Custom tags" dialogue box I cannot get the video to display with "Disable HTML Filtering" checkbox OFF. Even if I do the "Edit" and "Save" trick from above.



Discussion:
portal_transforms has its own cache (on a volatile attribute) of the body text transformed to text/x-html-safe, which lasts for an hour and doesn't get cleared unless you re-save the item or restart Zope. That's probably what's preventing you from seeing a change here.

If I understand correctly if I were to wait say an hour (or what ever the number is), the videos would show then? Or not show depending on the html filtering settings?

BTW thanks for responding, Im trying to get my head around the filtering setting and testing to see if they work as expected.  :)

Presumably any changes to the filtering settings would work after an hour, but you should probably confirm that.

Thankyou! Ill do that. If everything turns out copasetic how would you suggest I proceed? Id think there should be some text added in the HTML panel like "Please note that changes to this panel will take about an hour to take effect" something along those lines. Would this be a PLIP request.. it just seem so .. minor to be a plip.

Would anyone object to some help text being added to this effect? (@bledwell it doesn't have to be a plip)

Looks like this was fixed in https://github.com/plone/Products.CMFPlone/commit/1e441aed21a31fd6adfab9a03ec83f7e81c85f8c by @vangheem . Though the text might be more visible to users if we (also) mention this in the flash message, instead of only "Changes saved."?

Converting this to a flash message would be great I think. This trips up users ALL the time.

Ok, I'll convert it to a flash message.


Resolving patch:
diff --git a/Products/CMFPlone/controlpanel/browser/filter.py b/Products/CMFPlone/controlpanel/browser/filter.py
--- a/Products/CMFPlone/controlpanel/browser/filter.py
+++ b/Products/CMFPlone/controlpanel/browser/filter.py
@@ -15,12 +15,7 @@
 class FilterControlPanel(AutoExtensibleForm, form.EditForm):
     id = "FilterControlPanel"
     label = _(u"HTML Filtering Settings")
-    description = _(
-        'description_html_filtering',
-        default=u"HTML generation is heavily cached across Plone. "
-                u"After changing settings here, you may have to edit "
-                u"existing content to see the changes in these filter settings "
-                u"or restart your server.")
+    description = ""
     schema = IFilterSchema
     form_name = _(u"HTML Filtering Settings")
     control_panel_view = "filter-controlpanel"
@@ -73,8 +68,8 @@ def handleSave(self, action):  # NOQA
         if disable_filtering != safe_html._config['disable_transform']:
             safe_html._config['disable_transform'] = disable_filtering
 
-        for attr in ('stripped_combinations', 'class_blacklist', 'stripped_attributes',
-                     'style_whitelist'):
+        for attr in ('stripped_combinations', 'class_blacklist',
+                     'stripped_attributes', 'style_whitelist'):
             value = data[attr]
             if value is None:
                 if attr == 'stripped_combinations':
@@ -92,6 +87,11 @@ def handleSave(self, action):  # NOQA
         IStatusMessage(self.request).addStatusMessage(
             _(u"Changes saved."),
             "info")
+        IStatusMessage(self.request).addStatusMessage(
+            _(u"HTML generation is heavily cached across Plone. You may "
+              u"have to edit existing content or restart your server to see "
+              u"the changes."),
+            "warning")
         self.request.response.redirect(self.request.getURL())
 
 


Test patch:
diff --git a/Products/CMFPlone/tests/robot/test_controlpanel_filter.robot b/Products/CMFPlone/tests/robot/test_controlpanel_filter.robot
--- a/Products/CMFPlone/tests/robot/test_controlpanel_filter.robot
+++ b/Products/CMFPlone/tests/robot/test_controlpanel_filter.robot
@@ -69,6 +69,11 @@ Scenario: Configure Filter Control Panel to filter out classes
    When I add 'foobar' to the filtered classes
    Then the 'foobar' class is filtered out when a document is saved
 
+Scenario: Filter Control Panel displays information regarding caching when saved
+  Given a logged-in site administrator
+    and the filter control panel
+   When I save the form
+   Then success message should contain information regarding caching
 
 
 *** Keywords *****************************************************************
@@ -124,6 +129,10 @@ I add '${tags}' and '${attributes}' to the stripped out combinations
   Click Button  Save
   Wait until page contains  Changes saved
 
+I save the form
+  Click Button  Save
+  Wait until page contains  Changes saved
+
 
 # --- THEN -------------------------------------------------------------------
 
@@ -202,3 +211,6 @@ the 'display' style attribute is preserved when a document is saved
 
   XPath Should Match X Times  //*[@id='content-core']//h4  1  message=h4 tag should be present
   XPath Should Match X Times  //*[@id='content-core']//h4[@style]  1  message=style attribute with display:block should be present
+
+success message should contain information regarding caching
+  Element Should Contain  css=.portalMessage.warning  HTML generation is heavily cached across Plone. You may have to edit existing content or restart your server to see the changes.