Commit 96fc60e5 authored by Aurel's avatar Aurel

fix import

only generate plugin method for HBTreeFolder thus avoiding overriding
method of some folder wich are not Btree
and some method must always called the one CMFBTree



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16307 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1b952ed0
...@@ -64,7 +64,7 @@ from random import randint ...@@ -64,7 +64,7 @@ from random import randint
import os import os
from zLOG import LOG, PROBLEM from zLOG import LOG, PROBLEM, WARNING
import warnings import warnings
REINDEX_SPLIT_COUNT = 100 # if folder containes more than this, reindexing should be splitted. REINDEX_SPLIT_COUNT = 100 # if folder containes more than this, reindexing should be splitted.
...@@ -435,14 +435,19 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, ...@@ -435,14 +435,19 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn,
if self._plugin is None: if self._plugin is None:
if self._isHBTree: if self._isHBTree:
self._plugin = CMFHBTreeFolder self._plugin = CMFHBTreeFolder
self._generatePluginMethod()
elif self._isBTree: elif self._isBTree:
self._plugin = CMFBTreeFolder self._plugin = CMFBTreeFolder
else: else:
raise ValueError, "No plugin defined" raise ValueError, 'No plugin defined'
self._generatePluginMethod()
self._plugin.__init__(self, self.id) self._plugin.__init__(self, self.id)
return FolderMixIn.newContent(self, *args, **kw) return FolderMixIn.newContent(self, *args, **kw)
security.declareProtected( Permissions.ManagePortal, 'migrateToHBTree' )
def resetPlugin(self):
""" reset plugin attribute """
self._plugin = None
security.declareProtected(Permissions.View, 'isBTree') security.declareProtected(Permissions.View, 'isBTree')
def isBTree(self): def isBTree(self):
""" Return if folder is a BTree or not """ """ Return if folder is a BTree or not """
...@@ -925,10 +930,6 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, ...@@ -925,10 +930,6 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn,
def _getVisibleAllowedContentTypeList(): def _getVisibleAllowedContentTypeList():
hidden_type_list = portal.portal_types.getTypeInfo(self)\ hidden_type_list = portal.portal_types.getTypeInfo(self)\
.getHiddenContentTypeList() .getHiddenContentTypeList()
try:
return [ ti.id for ti in self._plugin.allowedContentTypes(self)
if ti.id not in hidden_type_list ]
except AttributeError:
return [ ti.id for ti in CMFBTreeFolder.allowedContentTypes(self) return [ ti.id for ti in CMFBTreeFolder.allowedContentTypes(self)
if ti.id not in hidden_type_list ] if ti.id not in hidden_type_list ]
...@@ -974,9 +975,6 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, ...@@ -974,9 +975,6 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn,
# account i18n into consideration. # account i18n into consideration.
# XXX So sorting should be done in skins, after translation is performed. # XXX So sorting should be done in skins, after translation is performed.
def compareTypes(a, b): return cmp(a.title or a.id, b.title or b.id) def compareTypes(a, b): return cmp(a.title or a.id, b.title or b.id)
try:
type_list = self._plugin.allowedContentTypes(self)
except AttributeError:
type_list = CMFBTreeFolder.allowedContentTypes(self) type_list = CMFBTreeFolder.allowedContentTypes(self)
type_list.sort(compareTypes) type_list.sort(compareTypes)
return ['/'.join(x.getPhysicalPath()) for x in type_list] return ['/'.join(x.getPhysicalPath()) for x in type_list]
......
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