[Erp5-report] r26335 - in /erp5/trunk/bt5/erp5_administration: ExtensionTemplateItem/ PathT...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 7 15:23:58 CEST 2009


Author: luke
Date: Tue Apr  7 15:23:57 2009
New Revision: 26335

URL: http://svn.erp5.org?rev=26335&view=rev
Log:
- add scripts and alarm to check and fix _folder_handler

Added:
    erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_folder_handler.xml
    erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkFolderHandler.xml
    erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/checkFolderHandler.xml
Modified:
    erp5/trunk/bt5/erp5_administration/ExtensionTemplateItem/ERP5Administration.py
    erp5/trunk/bt5/erp5_administration/bt/revision
    erp5/trunk/bt5/erp5_administration/bt/template_path_list

Modified: erp5/trunk/bt5/erp5_administration/ExtensionTemplateItem/ERP5Administration.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/ExtensionTemplateItem/ERP5Administration.py?rev=26335&r1=26334&r2=26335&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_administration/ExtensionTemplateItem/ERP5Administration.py [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/ExtensionTemplateItem/ERP5Administration.py [utf8] Tue Apr  7 15:23:57 2009
@@ -1,3 +1,4 @@
+from zLOG import LOG, INFO
 def dumpWorkflowChain(self):
   # This method outputs the workflow chain in the format that you can
   # easily get diff like the following:
@@ -27,3 +28,34 @@
     for chain in i['chain']:
       output.append('%s,%s' % (i['id'], chain))
   return '\n'.join(output)
+
+def checkFolderHandler(self, fixit=0, **kw):
+  error_list = []
+  try:
+    is_btree = self.isBTree()
+    is_hbtree = self.isHBTree()
+  except AttributeError:
+    return error_list
+  message = '%s' % self.absolute_url_path()
+  problem = False
+  if not is_btree and not is_hbtree:
+    problem = True
+    message = '%s is NOT BTree NOR HBTree' % message
+    if fixit:
+      try:
+        result = self._fixFolderHandler()
+      except AttributeError:
+        result = False
+      if result:
+        message = '%s fixed' % message
+      else:
+        message = '%s CANNOT FIX' % message
+  if is_btree and is_hbtree:
+    problem = True
+    message = '%s is BTree and HBTree' % message
+    if fixit:
+      message = '%s CANNOT FIX' % message
+  if problem:
+    error_list.append(message)
+    LOG('checkFolderHandler', INFO, message)
+  return error_list

Added: erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_folder_handler.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_folder_handler.xml?rev=26335&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_folder_handler.xml (added)
+++ erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_folder_handler.xml [utf8] Tue Apr  7 15:23:57 2009
@@ -1,0 +1,94 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>active_sense_method_id</string> </key>
+            <value> <string>ERP5Site_checkFolderHandler</string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>enabled</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>check_folder_handler</string> </value>
+        </item>
+        <item>
+            <key> <string>periodicity_hour</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_minute</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_month</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_month_day</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_start_date</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="DateTime" module="DateTime.DateTime"/>
+                </klass>
+                <tuple>
+                  <none/>
+                </tuple>
+                <state>
+                  <tuple>
+                    <float>1230768000.0</float>
+                    <string>GMT</string>
+                  </tuple>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_week</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_week_frequency</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Alarm</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Checks folder handler</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Added: erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkFolderHandler.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkFolderHandler.xml?rev=26335&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkFolderHandler.xml (added)
+++ erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkFolderHandler.xml [utf8] Tue Apr  7 15:23:57 2009
@@ -1,0 +1,164 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </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>def checkTopLevel():\n
+  portal = context.getPortalObject()\n
+  for o in portal.objectValues():\n
+    error_list = o.checkFolderHandler(fixit=fixit)\n
+    if len(error_list):\n
+      portal.portal_activities.activate(active_process=active_process, priority=2) \\\n
+      .Base_makeActiveResult(title=o.absolute_url_path(), error_list=error_list)\n
+\n
+if \'tag\' not in kwargs:\n
+  kwargs[\'tag\'] = []\n
+\n
+kwargs.update(\n
+    method_id=\'checkFolderHandler\',\n
+    method_kw={\'fixit\': fixit},\n
+)\n
+\n
+if context.getPortalType() == \'Alarm\':\n
+  active_process = context.newActiveProcess().getPath()\n
+  ERP5Site_checkDataWithScript = context.ERP5Site_checkDataWithScript\n
+else:\n
+  active_process = context.portal_activities.newActiveProcess().getPath()\n
+  ERP5Site_checkDataWithScript = context.portal_activities.ERP5Site_checkDataWithScript\n
+  print \'Results will be saved to %s\' % active_process\n
+\n
+checkTopLevel()\n
+ERP5Site_checkDataWithScript(\n
+  active_process=active_process,\n
+  *args,\n
+  **kwargs)\n
+\n
+return printed\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>fixit=0, *args, **kwargs</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>fixit</string>
+                            <string>args</string>
+                            <string>kwargs</string>
+                            <string>_print_</string>
+                            <string>_print</string>
+                            <string>active_process</string>
+                            <string>checkTopLevel</string>
+                            <string>_write_</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>ERP5Site_checkDataWithScript</string>
+                            <string>_apply_</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <int>0</int>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>ERP5Site_checkFolderHandler</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Added: erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/checkFolderHandler.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/checkFolderHandler.xml?rev=26335&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/checkFolderHandler.xml (added)
+++ erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/checkFolderHandler.xml [utf8] Tue Apr  7 15:23:57 2009
@@ -1,0 +1,31 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_function</string> </key>
+            <value> <string>checkFolderHandler</string> </value>
+        </item>
+        <item>
+            <key> <string>_module</string> </key>
+            <value> <string>ERP5Administration</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>checkFolderHandler</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_administration/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/bt/revision?rev=26335&r1=26334&r2=26335&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_administration/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/bt/revision [utf8] Tue Apr  7 15:23:57 2009
@@ -1,1 +1,1 @@
-53
+55

Modified: erp5/trunk/bt5/erp5_administration/bt/template_path_list
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/bt/template_path_list?rev=26335&r1=26334&r2=26335&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_administration/bt/template_path_list [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/bt/template_path_list [utf8] Tue Apr  7 15:23:57 2009
@@ -1,1 +1,2 @@
-portal_alarms/check_catalog
+portal_alarms/check_catalog
+portal_alarms/check_folder_handler




More information about the Erp5-report mailing list