[Erp5-report] r16618 - /erp5/trunk/products/ERP5Type/Core/Folder.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Sep 26 07:48:45 CEST 2007


Author: vincent
Date: Wed Sep 26 07:48:45 2007
New Revision: 16618

URL: http://svn.erp5.org?rev=16618&view=rev
Log:
Re-apply commit r16607 with a quickfix to make bootstrap work.

Modified:
    erp5/trunk/products/ERP5Type/Core/Folder.py

Modified: erp5/trunk/products/ERP5Type/Core/Folder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/Folder.py?rev=16618&r1=16617&r2=16618&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/Folder.py (original)
+++ erp5/trunk/products/ERP5Type/Core/Folder.py Wed Sep 26 07:48:45 2007
@@ -375,10 +375,7 @@
     return getattr(CMFBTreeFolder, id)
 
   def isApplicable(self, folder):
-    result = False
-    if getattr(folder, '_tree', None) is not None:
-      result = True
-    return result
+    return '_tree' in getattr(folder, '__dict__', tuple())
 
 class CMFHBTreeFolderHandler(FolderHandler):
 
@@ -389,10 +386,7 @@
     return getattr(CMFHBTreeFolder, id)
 
   def isApplicable(self, folder):
-    result = False
-    if getattr(folder, '_htree', None) is not None:
-      result = True
-    return result
+    return '_htree' in getattr(folder, '__dict__', tuple())
 
 class OFSFolderHandler(FolderHandler):
 
@@ -403,10 +397,22 @@
     return getattr(OFSFolder, id)
 
   def isApplicable(self, folder):
-    result = False
-    if getattr(folder, '_objects', None) is not None:
-      result = True
-    return result
+    """
+      XXX: until folder handlers are prioritized and OFS Folder Handler is
+      made last, OR if OFS Folder Handler is the default fallback, the
+      definition of an OFS Folder is only possible as "not a BTreeFolder2 nor
+      a HBTreeFolder2'.
+      This is very dirty, but will be sufficient to fix current folder format
+      detection code.
+
+      Original idea is:
+        return '_objects' in getattr(folder, '__dict__', tuple())
+      But this code is invalid because existing empty folders contain no
+      '_object' property (it's actually defined on the class, not on the
+      instance).
+    """
+    return not('_tree' in getattr(folder, '__dict__', tuple())) \
+       and not('_htree' in getattr(folder, '__dict__', tuple()))
 
 global folder_handler_dict
 folder_handler_dict = {}




More information about the Erp5-report mailing list