Alarm_checkPromiseBt5.xml 3.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
<?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>_body</string> </key>
            <value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n
\n
portal = context.getPortalObject()\n
bt5 = portal.getPromiseParameter(\'portal_templates\', \'expected_bt5\')\n
\n
if bt5 is None:\n
  return\n
\n
active_result = ActiveResult()\n
\n
63 64 65
bt5_list = [x[1] for x in portal.portal_templates.resolveBusinessTemplateListDependency("vifib_erp5".split(\'\\n\'), newest_only=True)]\n
bt5_list.extend([x.getTitle() for x in portal.portal_templates.getUpdatedRepositoryBusinessTemplateList()])\n
bt5_list = list(set(bt5_list))\n
66 67 68 69 70 71 72 73 74 75 76
\n
# XXX Can not import BusinessTemplateUnknownError\n
# except BusinessTemplateUnknownError, error:\n
#   active_result.edit(\n
#     summary="Unable to resolve bt5 dependencies", \n
#     severity=5, \n
#     detail=error)\n
\n
severity = len(bt5_list)\n
if severity == 0:\n
  summary = "Nothing to do."\n
Romain Courteaud's avatar
Romain Courteaud committed
77
  detail = ""\n
78 79
else:\n
  summary = "Upgrade needed"\n
80
  detail = "Needed to install %s" % \', \'.join(bt5_list)\n
81 82
active_result.edit(\n
  summary=summary, \n
83 84
  severity=severity,\n
  detail=detail)\n
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
\n
context.newActiveProcess().postResult(active_result)\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>tag, fixit=False, **kw</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Alarm_checkPromiseBt5</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>