Commit 3ae3590c authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Dump Web Page Module Content Hash for comparation

parent 5b2ece44
......@@ -44,6 +44,12 @@ if show_all or configuration == "skins":
found = portal.ERP5Site_dumpPortalSkinsContent()
print resolveDiff("Skins Configuration Diff", expected_file, found)
if show_all or configuration == "web_content":
expected_file = portal.expected_web_page_module_configuration
found = portal.ERP5Site_dumpWebPageModuleContent(
ignore_string_on_reference=["rapid_"])
print resolveDiff("Web Content Configuration Diff", expected_file, found)
if show_all or configuration == "actions":
expected_file = portal.expected_type_actions_dumped_configuration
found = portal.ERP5Site_dumpPortalTypeActionList()
......
import hashlib
portal = context.getPortalObject()
def getWebContentHash(document):
content = document.getTextContent("ignore")
m = hashlib.md5()
m.update(content)
content_hash = m.hexdigest()
return ";".join((document.getReference(), content_hash))
zero_to_nine_list = range(10)
for document in portal.web_page_module.searchFolder(
validation_state=["published", "published_alive"]):
document_id_first_letter = document.getId()[0]
if document_id_first_letter in zero_to_nine_list:
continue
print_web_content = 1
document_reference = str(document.getReference(""))
for ignore_string in ignore_string_on_reference:
if ignore_string in document_reference:
print_web_content = 0
break
if print_web_content:
print getWebContentHash(document)
container.REQUEST.RESPONSE.setHeader('content-type', 'text/plain')
return '\n'.join(sorted(printed.splitlines()))
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</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>_params</string> </key>
<value> <string>ignore_string_on_reference=["rapid"]</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_dumpWebPageModuleContent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_web_page_module_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_web_page_module_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -41,6 +41,7 @@ class TestSlapOSDump(SlapOSTestCaseMixin):
('ERP5Site_dumpPropertySheetList', 'expected_property_sheet_dumped_configuration', None),
('ERP5Site_dumpRuleTesterList', 'expected_rule_dumped_configuration', None),
('ERP5Site_dumpSkinProperty', 'expected_skin_property_dumped_configuration', None),
('ERP5Site_dumpWebPageModuleContent', 'expected_web_page_module_configuration', None),
('ERP5Site_dumpWorkflowChain', 'expected_workflow_dumped_configuration', None),
]:
ZopeTestCase._print('\n')
......
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