[CMF-checkins] CVS: CMF/CMFCore - CatalogTool.py:1.45
FSDTMLMethod.py:1.19 __init__.py:1.25
Yvo Schubbe
schubbe at web.de
Thu Sep 25 06:30:00 EDT 2003
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv24804/CMFCore
Modified Files:
CatalogTool.py FSDTMLMethod.py __init__.py
Log Message:
cleanup:
- removed pre 'Zope 2.4.3 with PageTemplates' backwards compatibility cruft
- replaced apply by direct calls
=== CMF/CMFCore/CatalogTool.py 1.44 => 1.45 ===
--- CMF/CMFCore/CatalogTool.py:1.44 Mon Sep 1 11:18:34 2003
+++ CMF/CMFCore/CatalogTool.py Thu Sep 25 06:29:59 2003
@@ -20,6 +20,7 @@
from DateTime import DateTime
from AccessControl.PermissionRole import rolesForPermissionOn
from AccessControl import ClassSecurityInfo
+
from utils import _checkPermission
from utils import _dtmldir
from utils import _getAuthenticatedUser
@@ -154,30 +155,17 @@
)
def _initIndexes(self):
- base = aq_base(self)
- if hasattr(base, 'addIndex'):
- # Zope 2.4
- addIndex = self.addIndex
- else:
- # Zope 2.3 and below
- addIndex = self._catalog.addIndex
- if hasattr(base, 'addColumn'):
- # Zope 2.4
- addColumn = self.addColumn
- else:
- # Zope 2.3 and below
- addColumn = self._catalog.addColumn
# Content indexes
self._catalog.indexes.clear()
for index_name, index_type in self.enumerateIndexes():
- addIndex( index_name, index_type )
+ self.addIndex(index_name, index_type)
# Cached metadata
self._catalog.names = ()
self._catalog.schema.clear()
for column_name in self.enumerateColumns():
- addColumn( column_name )
+ self.addColumn(column_name)
#
# ZMI methods
@@ -205,17 +193,11 @@
kw[ 'allowedRolesAndUsers' ] = self._listAllowedRolesAndUsers( user )
if not _checkPermission( AccessInactivePortalContent, self ):
- base = aq_base( self )
now = DateTime()
- if hasattr( base, 'addIndex' ): # Zope 2.4 and above
- kw[ 'effective' ] = { 'query' : now, 'range' : 'max' }
- kw[ 'expires' ] = { 'query' : now, 'range' : 'min' }
- else: # Zope 2.3
- kw[ 'effective' ] = kw[ 'expires' ] = now
- kw[ 'effective_usage'] = 'range:max'
- kw[ 'expires_usage' ] = 'range:min'
+ kw['effective'] = {'query': now, 'range': 'max'}
+ kw['expires'] = {'query': now, 'range': 'min'}
- return apply(ZCatalog.searchResults, (self, REQUEST), kw)
+ return ZCatalog.searchResults(self, REQUEST, **kw)
__call__ = searchResults
=== CMF/CMFCore/FSDTMLMethod.py 1.18 => 1.19 ===
--- CMF/CMFCore/FSDTMLMethod.py:1.18 Mon Sep 1 11:59:41 2003
+++ CMF/CMFCore/FSDTMLMethod.py Thu Sep 25 06:29:59 2003
@@ -18,7 +18,9 @@
import Globals
from AccessControl import ClassSecurityInfo, getSecurityManager
from OFS.DTMLMethod import DTMLMethod, decapitate, guess_content_type
+from AccessControl.DTML import RestrictedDTML
from AccessControl.Role import RoleManager
+from OFS.Cache import Cacheable
from utils import _dtmldir
from CMFCorePermissions import FTPAccess
@@ -27,16 +29,10 @@
from DirectoryView import registerFileExtension, registerMetaType, expandpath
from FSObject import FSObject
-try:
- # Zope 2.4.x
- from AccessControl.DTML import RestrictedDTML
-except ImportError:
- class RestrictedDTML: pass
-
-from OFS.Cache import Cacheable
_marker = [] # Create a new marker object.
+
class FSDTMLMethod(RestrictedDTML, RoleManager, FSObject, Globals.HTML):
"""FSDTMLMethods act like DTML methods but are not directly
modifiable from the management interface."""
@@ -128,14 +124,14 @@
if client is None:
# Called as subtemplate, so don't need error propagation!
- r=apply(Globals.HTML.__call__, (self, client, REQUEST), kw)
+ r = Globals.HTML.__call__(self, client, REQUEST, **kw)
if RESPONSE is None: result = r
else: result = decapitate(r, RESPONSE)
if not self._cache_namespace_keys:
self.ZCacheable_set(result)
return result
- r=apply(Globals.HTML.__call__, (self, client, REQUEST), kw)
+ r = Globals.HTML.__call__(self, client, REQUEST, **kw)
if type(r) is not type('') or RESPONSE is None:
if not self._cache_namespace_keys:
self.ZCacheable_set(r)
=== CMF/CMFCore/__init__.py 1.24 => 1.25 ===
--- CMF/CMFCore/__init__.py:1.24 Wed Sep 24 06:02:14 2003
+++ CMF/CMFCore/__init__.py Thu Sep 25 06:29:59 2003
@@ -15,6 +15,8 @@
$Id$
"""
+from sys import modules
+
from AccessControl import allow_module
import PortalObject, PortalContent, PortalFolder
@@ -24,6 +26,7 @@
import URLTool
import DirectoryView, FSImage, FSFile, FSPropertiesObject
import FSDTMLMethod, FSPythonScript, FSSTXMethod
+import FSPageTemplate
import FSZSQLMethod
import CookieCrumbler
import ContentTypeRegistry
@@ -35,16 +38,9 @@
allow_module('Products.CMFCore.CMFCoreExceptions')
-try:
- import FSPageTemplate
-except ImportError:
- HAS_PAGE_TEMPLATES = 0
-else:
- HAS_PAGE_TEMPLATES = 1
-
-
# Old name that some third-party packages may need.
ADD_FOLDERS_PERMISSION = AddPortalFolders
+HAS_PAGE_TEMPLATES = 1
bases = (
PortalObject.PortalObjectBase,
@@ -66,9 +62,7 @@
URLTool.URLTool,
)
-
-import sys
-this_module = sys.modules[ __name__ ]
+this_module = modules[ __name__ ]
z_bases = utils.initializeBasesPhase1(bases, this_module)
z_tool_bases = utils.initializeBasesPhase1(tools, this_module)
@@ -113,9 +107,6 @@
icon = 'images/registry.gif'
)
- if HAS_PAGE_TEMPLATES:
- utils.registerIcon(FSPageTemplate.FSPageTemplate,
- 'images/fspt.gif', globals())
utils.registerIcon(FSDTMLMethod.FSDTMLMethod,
'images/fsdtml.gif', globals())
utils.registerIcon(FSPythonScript.FSPythonScript,
@@ -124,6 +115,8 @@
'images/fsimage.gif', globals())
utils.registerIcon(FSFile.FSFile,
'images/fsfile.gif', globals())
+ utils.registerIcon(FSPageTemplate.FSPageTemplate,
+ 'images/fspt.gif', globals())
utils.registerIcon(FSPropertiesObject.FSPropertiesObject,
'images/fsprops.gif', globals())
utils.registerIcon(FSZSQLMethod.FSZSQLMethod,
@@ -133,11 +126,8 @@
utils.registerIcon(TypesTool.ScriptableTypeInformation,
'images/typeinfo.gif', globals())
- try:
- context.registerHelpTitle( 'CMF Core Help' )
- context.registerHelp(directory='interfaces')
- except: # AARGH!!
- pass
+ context.registerHelpTitle('CMF Core Help')
+ context.registerHelp(directory='interfaces')
utils.ToolInit( 'CMF Core Tool'
, tools=tools
More information about the CMF-checkins
mailing list