Commit 66cfe1e0 authored by Jérome Perrin's avatar Jérome Perrin

administration: output md5sum of skin content in ERP5Site_dumpPortalSkinsContent

parent 57c4d812
for skin_folder in context.getPortalObject().portal_skins.objectValues('Folder'):
import hashlib
portal = context.getPortalObject()
def getSkinHash(skin, skin_container):
content = ''
if skin.meta_type in ('Script (Python)', 'Z SQL Method', ):
content = skin.document_src()
elif skin.meta_type in ('File', ):
content = str(skin.data)
elif skin.meta_type in ('ERP5 Form', ):
try:
content = skin.formXML()
if isinstance(content, unicode):
content = content.encode('utf8', 'repr')
except AttributeError, e:
# This can happen with dead proxy fields.
content = "broken form %s" % e
content = 'ignore'
m = hashlib.md5()
m.update(content)
content_hash = m.hexdigest()
return ";".join((skin_container.getId(), skin.getId(), skin.meta_type, content_hash))
for skin_folder in portal.portal_skins.objectValues('Folder'):
if ignore_custom and skin_folder.getId() == 'custom':
continue
for skin in skin_folder.objectValues():
print ";".join((skin_folder.getId(), skin.getId(), skin.meta_type))
print getSkinHash(skin, skin_folder)
if include_workflow_scripts:
for workflow in portal.portal_workflow.objectValues():
for skin in workflow.scripts.objectValues():
print getSkinHash(skin, workflow)
container.REQUEST.RESPONSE.setHeader('content-type', 'text/plain')
return '\n'.join(sorted(printed.splitlines()))
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>ignore_custom=True, include_workflow_scripts=True</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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