Commit 6684c59f authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_cache migrated to new bt format

parent f449cb6c
from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject()
web_site_module = getattr(portal, 'web_site_module', None)
if web_site_module is None:
# web_site_module is not present yet, so it is impossible
# to keep the promise
return False
shacache = getattr(web_site_module, 'shacache', None)
shadir = getattr(web_site_module, 'shadir', None)
expected_state = context.portal_preferences.getPreferredShacacheWebsiteExpectedState("published")
active_result = ActiveResult()
if expected_state == "published" and shacache is None:
severity = 1
summary = "Shacache WebSite do not exist"
detail = ""
elif expected_state == "published" and shadir is None:
severity = 1
summary = "Shadir WebSite do not exist"
detail = ""
elif expected_state == "published" and shacache.getSkinSelectionName() != "SHACACHE":
severity = 1
summary = "shacache site don't have SHACACHE as skin selection name"
detail = ""
elif expected_state == "published" and shadir.getSkinSelectionName() != "SHADIR":
severity = 1
summary = "shadir site don't have SHADIR as skin selection name"
detail = ""
elif shacache is not None and shacache.getValidationState() != expected_state:
severity = 1
summary = "shacache site is not what is expected: %s" % expected_state
detail = ""
elif shadir is not None and shadir.getValidationState() != expected_state:
severity = 1
summary = "shadir site is not published %s" % expected_state
detail = ""
else:
severity = 0
summary = "Nothing to do."
detail = ""
active_result.edit(
summary=summary,
severity=severity,
detail=detail)
context.newActiveProcess().postResult(active_result)
......@@ -48,60 +48,6 @@
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n
\n
portal = context.getPortalObject()\n
web_site_module = getattr(portal, \'web_site_module\', None)\n
if web_site_module is None:\n
# web_site_module is not present yet, so it is impossible\n
# to keep the promise\n
return False\n
\n
shacache = getattr(web_site_module, \'shacache\', None)\n
shadir = getattr(web_site_module, \'shadir\', None)\n
\n
expected_state = context.portal_preferences.getPreferredShacacheWebsiteExpectedState("published")\n
\n
active_result = ActiveResult()\n
if expected_state == "published" and shacache is None:\n
severity = 1\n
summary = "Shacache WebSite do not exist"\n
detail = ""\n
elif expected_state == "published" and shadir is None:\n
severity = 1\n
summary = "Shadir WebSite do not exist"\n
detail = ""\n
elif expected_state == "published" and shacache.getSkinSelectionName() != "SHACACHE":\n
severity = 1\n
summary = "shacache site don\'t have SHACACHE as skin selection name"\n
detail = ""\n
elif expected_state == "published" and shadir.getSkinSelectionName() != "SHADIR":\n
severity = 1\n
summary = "shadir site don\'t have SHADIR as skin selection name"\n
detail = ""\n
elif shacache is not None and shacache.getValidationState() != expected_state:\n
severity = 1\n
summary = "shacache site is not what is expected: %s" % expected_state\n
detail = ""\n
elif shadir is not None and shadir.getValidationState() != expected_state:\n
severity = 1\n
summary = "shadir site is not published %s" % expected_state\n
detail = ""\n
else:\n
severity = 0\n
summary = "Nothing to do."\n
detail = ""\n
\n
active_result.edit(\n
summary=summary, \n
severity=severity,\n
detail=detail)\n
\n
context.newActiveProcess().postResult(active_result)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit=False, **kw</string> </value>
......
portal = context.getPortalObject()
shacache = getattr(portal.web_site_module, 'shacache', None)
shadir = getattr(portal.web_site_module, 'shadir', None)
expected_state = context.portal_preferences.getPreferredShacacheWebsiteExpectedState("published")
if expected_state == "published" and shacache is None:
shacache = portal.web_site_module.newContent(id='shacache',
title="Shacache")
if expected_state == "published" and shadir is None:
shadir = portal.web_site_module.newContent(id='shadir',
title="Shadir")
if shadir is None and shacache is None:
# Nothing to do
return
if expected_state == "published":
shacache.setSkinSelectionName("SHACACHE")
shadir.setSkinSelectionName("SHADIR")
if expected_state == "published":
if portal.portal_workflow.isTransitionPossible(shacache, "publish"):
shacache.publish()
if portal.portal_workflow.isTransitionPossible(shadir, "publish"):
shadir.publish()
return
if portal.portal_workflow.isTransitionPossible(shacache, "embeed"):
shacache.embeed()
if portal.portal_workflow.isTransitionPossible(shadir, "embeed"):
shadir.embeed()
......@@ -48,46 +48,6 @@
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
shacache = getattr(portal.web_site_module, \'shacache\', None)\n
shadir = getattr(portal.web_site_module, \'shadir\', None)\n
\n
expected_state = context.portal_preferences.getPreferredShacacheWebsiteExpectedState("published")\n
\n
if expected_state == "published" and shacache is None:\n
shacache = portal.web_site_module.newContent(id=\'shacache\', \n
title="Shacache")\n
\n
if expected_state == "published" and shadir is None:\n
shadir = portal.web_site_module.newContent(id=\'shadir\',\n
title="Shadir")\n
\n
if shadir is None and shacache is None:\n
# Nothing to do\n
return \n
\n
if expected_state == "published":\n
shacache.setSkinSelectionName("SHACACHE")\n
shadir.setSkinSelectionName("SHADIR")\n
\n
if expected_state == "published":\n
if portal.portal_workflow.isTransitionPossible(shacache, "publish"):\n
shacache.publish()\n
\n
if portal.portal_workflow.isTransitionPossible(shadir, "publish"):\n
shadir.publish()\n
return\n
\n
\n
if portal.portal_workflow.isTransitionPossible(shacache, "embeed"):\n
shacache.embeed()\n
\n
if portal.portal_workflow.isTransitionPossible(shadir, "embeed"):\n
shadir.embeed()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
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