[CMF-checkins] CVS: Products/CMFCore - CMFBTreeFolder.py:1.1.2.1
__init__.py:1.28.2.3
Tres Seaver
tseaver at palladion.com
Tue Jul 12 22:31:32 EDT 2005
Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv15074/CMFCore
Modified Files:
Tag: CMF-1_5-branch
__init__.py
Added Files:
Tag: CMF-1_5-branch
CMFBTreeFolder.py
Log Message:
- CMFCore/CMFBTreeFolder.py: Moved here from Zope core's
Products/BTreeFolder2; conditional import, with module alias, into
__init__.py, for compatibility with Zope 2.7; 2.8.0 has BTreeFolder2
in the core (see http://www.zope.org/Collectors/Zope/1813).
=== Added File Products/CMFCore/CMFBTreeFolder.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""CMFBTreeFolder
$Id: CMFBTreeFolder.py,v 1.1.2.1 2005/07/13 02:31:01 tseaver Exp $
"""
from AccessControl.SecurityInfo import ClassSecurityInfo
from Globals import InitializeClass
from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2Base
from PortalFolder import PortalFolderBase
from PortalFolder import factory_type_information as PortalFolder_FTI
_actions = PortalFolder_FTI[0]['actions']
factory_type_information = ( { 'id' : 'CMF BTree Folder',
'meta_type' : 'CMF BTree Folder',
'description' : """\
CMF folder designed to hold a lot of objects.""",
'icon' : 'folder_icon.gif',
'product' : 'CMFCore',
'factory' : 'manage_addCMFBTreeFolder',
'filter_content_types' : 0,
'immediate_view' : 'folder_edit_form',
'actions' : _actions,
},
)
def manage_addCMFBTreeFolder(dispatcher, id, title='', REQUEST=None):
"""Adds a new BTreeFolder object with id *id*.
"""
id = str(id)
ob = CMFBTreeFolder(id)
ob.title = str(title)
dispatcher._setObject(id, ob)
ob = dispatcher._getOb(id)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(ob.absolute_url() + '/manage_main' )
class CMFBTreeFolder(BTreeFolder2Base, PortalFolderBase):
"""BTree folder for CMF sites.
"""
meta_type = 'CMF BTree Folder'
security = ClassSecurityInfo()
def __init__(self, id, title=''):
PortalFolderBase.__init__(self, id, title)
BTreeFolder2Base.__init__(self, id)
def _checkId(self, id, allow_dup=0):
PortalFolderBase._checkId(self, id, allow_dup)
BTreeFolder2Base._checkId(self, id, allow_dup)
InitializeClass(CMFBTreeFolder)
=== Products/CMFCore/__init__.py 1.28.2.2 => 1.28.2.3 ===
--- Products/CMFCore/__init__.py:1.28.2.2 Thu Jul 7 12:52:34 2005
+++ Products/CMFCore/__init__.py Tue Jul 12 22:31:01 2005
@@ -69,6 +69,31 @@
cmfcore_globals=globals()
+_CONTENT_TYPES = ( PortalFolder.PortalFolder, )
+_EXTRA_CONSTRUCTORS = ( PortalFolder.manage_addPortalFolder, )
+_FTI = ( PortalFolder.factory_type_information, )
+
+
+# BBB / FFF: We provide CMFBTreeFolder IFF the BTreeFolder2 product is
+# available, which it is by default in Zope 2.8.0.
+try:
+ import Products.BTreeFolder2
+except ImportError:
+ pass
+else:
+ # Because persistent objects may be out there which were
+ # created when the module was in that product, we need
+ # __module_aliases__ .
+ __module_aliases__ = ( ( 'Products.BTreeFolder2.CMFBTreeFolder'
+ , 'Products.CMFCore.CMFBTreeFolder'
+ )
+ ,
+ )
+ import CMFBTreeFolder
+ _CONTENT_TYPES += ( CMFBTreeFolder.CMFBTreeFolder, )
+ _EXTRA_CONSTRUCTORS += ( CMFBTreeFolder.manage_addCMFBTreeFolder, )
+ _FTI += ( CMFBTreeFolder.factory_type_information, )
+
def initialize(context):
utils.initializeBasesPhase2(z_bases, context)
@@ -128,11 +153,10 @@
).initialize( context )
utils.ContentInit( 'CMF Core Content'
- , content_types=( PortalFolder.PortalFolder, )
+ , content_types=_CONTENT_TYPES
, permission=AddPortalFolders
- , extra_constructors=(
- PortalFolder.manage_addPortalFolder, )
- , fti=PortalFolder.factory_type_information
+ , extra_constructors=_EXTRA_CONSTRUCTORS
+ , fti=_FTI
).initialize( context )
# make registerHelp work with 2 directories
@@ -146,4 +170,3 @@
help.lastRegistered = None
context.registerHelp(directory='interfaces', clear=0)
context.registerHelpTitle('CMF Core Help')
-
More information about the CMF-checkins
mailing list