[CMF-checkins] SVN: CMF/branches/tseaver-pkg_resources/ Use the
"resource" loaders from the Basket product to find product-
relative data files
Tres Seaver
tseaver at palladion.com
Thu Nov 10 12:56:54 EST 2005
Log message for revision 40033:
Use the "resource" loaders from the Basket product to find product- relative data files
- ImageFile -> ImageResource
- DTMLFile -> DTMLResource
- PageTemplateFile -> PageTemplateResource.
Fall back to the originals if egg support is not present.
Changed:
U CMF/branches/tseaver-pkg_resources/CHANGES.txt
U CMF/branches/tseaver-pkg_resources/CMFActionIcons/ActionIconsTool.py
U CMF/branches/tseaver-pkg_resources/CMFActionIcons/exportimport.py
U CMF/branches/tseaver-pkg_resources/CMFCalendar/CalendarTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/ActionInformation.py
U CMF/branches/tseaver-pkg_resources/CMFCore/ActionProviderBase.py
U CMF/branches/tseaver-pkg_resources/CMFCore/ActionsTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/CMFCatalogAware.py
U CMF/branches/tseaver-pkg_resources/CMFCore/CachingPolicyManager.py
U CMF/branches/tseaver-pkg_resources/CMFCore/CatalogTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/ContentTypeRegistry.py
U CMF/branches/tseaver-pkg_resources/CMFCore/DirectoryView.py
U CMF/branches/tseaver-pkg_resources/CMFCore/DiscussionTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSDTMLMethod.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSFile.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSImage.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSPageTemplate.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSPropertiesObject.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSPythonScript.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSSTXMethod.py
U CMF/branches/tseaver-pkg_resources/CMFCore/FSZSQLMethod.py
U CMF/branches/tseaver-pkg_resources/CMFCore/MemberDataTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/MembershipTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/PortalFolder.py
U CMF/branches/tseaver-pkg_resources/CMFCore/RegistrationTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/SkinsTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/TypesTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/URLTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/UndoTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/WorkflowTool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/fiveactionstool.py
U CMF/branches/tseaver-pkg_resources/CMFCore/interfaces/_tools.py
U CMF/branches/tseaver-pkg_resources/CMFCore/utils.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/DiscussionTool.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/Document.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/DublinCore.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/Link.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/MembershipTool.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/MetadataTool.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/PropertiesTool.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/SyndicationTool.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/factory.py
U CMF/branches/tseaver-pkg_resources/CMFDefault/utils.py
U CMF/branches/tseaver-pkg_resources/CMFSetup/cachingpolicymgr.py
U CMF/branches/tseaver-pkg_resources/CMFSetup/contenttyperegistry.py
U CMF/branches/tseaver-pkg_resources/CMFSetup/properties.py
U CMF/branches/tseaver-pkg_resources/CMFSetup/skins.py
U CMF/branches/tseaver-pkg_resources/CMFSetup/typeinfo.py
U CMF/branches/tseaver-pkg_resources/CMFSetup/utils.py
U CMF/branches/tseaver-pkg_resources/CMFSetup/workflow.py
U CMF/branches/tseaver-pkg_resources/CMFUid/UniqueIdHandlerTool.py
U CMF/branches/tseaver-pkg_resources/DCWorkflow/Guard.py
U CMF/branches/tseaver-pkg_resources/DCWorkflow/States.py
U CMF/branches/tseaver-pkg_resources/DCWorkflow/Transitions.py
U CMF/branches/tseaver-pkg_resources/DCWorkflow/Variables.py
U CMF/branches/tseaver-pkg_resources/DCWorkflow/WorkflowUIMixin.py
U CMF/branches/tseaver-pkg_resources/DCWorkflow/Worklists.py
U CMF/branches/tseaver-pkg_resources/DCWorkflow/utils.py
U CMF/branches/tseaver-pkg_resources/GenericSetup/registry.py
U CMF/branches/tseaver-pkg_resources/GenericSetup/rolemap.py
U CMF/branches/tseaver-pkg_resources/GenericSetup/tool.py
U CMF/branches/tseaver-pkg_resources/GenericSetup/utils.py
-=-
Modified: CMF/branches/tseaver-pkg_resources/CHANGES.txt
===================================================================
--- CMF/branches/tseaver-pkg_resources/CHANGES.txt 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CHANGES.txt 2005-11-10 17:56:53 UTC (rev 40033)
@@ -2,6 +2,11 @@
New Features
+ - Use the "resource" loaders from the Basket product to find product-
+ relative data files: ImageFile -> ImageResource;
+ DTMLFile -> DTMLResource; o PageTemplateFile -> PageTemplateResource.
+ (falling back to the originals if egg support is not present).
+
- CMFCore: Make "filesystem skins" use the "pkg_resource" API for
loading product-relative data files (e.g. templates, python scripts,
etc.), in order to enable distribution of CMF-based products as
Modified: CMF/branches/tseaver-pkg_resources/CMFActionIcons/ActionIconsTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFActionIcons/ActionIconsTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFActionIcons/ActionIconsTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,19 +18,16 @@
import os
from Globals import InitializeClass
-from Globals import package_home
from AccessControl import ClassSecurityInfo
from OFS.SimpleItem import SimpleItem
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.CMFCore.Expression import Expression
from Products.CMFCore.utils import UniqueObject
+from Products.CMFCore.utils import PageTemplateResource
from permissions import ManagePortal
from permissions import View
-_wwwdir = os.path.join( package_home( globals() ), 'www' )
-
class ActionIcon( SimpleItem ):
security = ClassSecurityInfo()
@@ -356,7 +353,7 @@
) + SimpleItem.manage_options
security.declareProtected( ManagePortal, 'manage_editActionIcons' )
- manage_editActionIcons = PageTemplateFile( 'aitEdit', _wwwdir )
+ manage_editActionIcons = PageTemplateResource( 'www/aitEdit', globals() )
security.declareProtected( ManagePortal, 'manage_addActionIcon' )
def manage_addActionIcon( self
Modified: CMF/branches/tseaver-pkg_resources/CMFActionIcons/exportimport.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFActionIcons/exportimport.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFActionIcons/exportimport.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -19,10 +19,9 @@
from AccessControl import ClassSecurityInfo
from AccessControl.Permission import Permission
from Globals import InitializeClass
-from Globals import package_home
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import PageTemplateResource
from Products.CMFSetup.utils import CONVERTER
from Products.CMFSetup.utils import DEFAULT
@@ -32,9 +31,6 @@
from permissions import ManagePortal
-_pkgdir = package_home( globals() )
-_xmldir = os.path.join( _pkgdir, 'xml' )
-
#
# Configurator entry points
#
@@ -96,7 +92,7 @@
security.declarePrivate('_getExportTemplate')
def _getExportTemplate(self):
- return PageTemplateFile('aitExport.xml', _xmldir)
+ return PageTemplateResource('xml/aitExport.xml', globals())
InitializeClass(ActionIconsToolExportConfigurator)
Modified: CMF/branches/tseaver-pkg_resources/CMFCalendar/CalendarTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCalendar/CalendarTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCalendar/CalendarTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -22,9 +22,9 @@
from DateTime import DateTime
from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.CMFCore.utils import UniqueObject
+from Products.CMFCore.utils import PageTemplateResource
from permissions import ManagePortal
@@ -48,12 +48,16 @@
# ZMI methods
#
security.declareProtected( ManagePortal, 'manage_overview' )
- manage_overview = PageTemplateFile('www/explainCalendarTool', globals(),
- __name__='manage_overview')
+ manage_overview = PageTemplateResource( 'www/explainCalendarTool'
+ , globals()
+ , __name__='manage_overview'
+ )
security.declareProtected( ManagePortal, 'manage_configure' )
- manage_configure = PageTemplateFile('www/configureCalendarTool', globals(),
- __name__='manage_configure')
+ manage_configure = PageTemplateResource( 'www/configureCalendarTool'
+ , globals()
+ , __name__='manage_configure'
+ )
security.declareProtected( ManagePortal, 'edit_configuration' )
def edit_configuration(self, show_types, use_session, show_states=None):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/ActionInformation.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/ActionInformation.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/ActionInformation.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -24,10 +24,10 @@
from OFS.ObjectManager import IFAwareObjectManager
from OFS.OrderedFolder import OrderedFolder
from OFS.SimpleItem import SimpleItem
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zope.i18nmessageid import MessageID
from zope.interface import implements
+from Products.CMFCore.utils import PageTemplateResource
from Products.GenericSetup.interfaces import INodeImporter
from Expression import Expression
@@ -37,7 +37,6 @@
from interfaces.portal_actions import ActionInfo as z2IActionInfo
from permissions import View
from utils import _checkPermission
-from utils import _wwwdir
from utils import getToolByName
from utils import SimpleItemWithProperties
@@ -74,8 +73,8 @@
InitializeClass(ActionCategory)
-manage_addActionCategoryForm = PageTemplateFile('addActionCategory.zpt',
- _wwwdir)
+manage_addActionCategoryForm = PageTemplateResource(
+ 'www/addActionCategory.zpt', globals())
def manage_addActionCategory(self, id, REQUEST=None):
"""Add a new CMF Action Category object with ID *id*.
@@ -195,7 +194,8 @@
'title': info['title'],
'action_paths': tuple(action_paths)})
- template = PageTemplateFile('addAction.zpt', _wwwdir).__of__(self)
+ template = PageTemplateResource('www/addAction.zpt',
+ globals()).__of__(self)
return template(profiles=tuple(profiles))
def _extractChildren(node):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/ActionProviderBase.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/ActionProviderBase.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/ActionProviderBase.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,7 +16,6 @@
"""
from AccessControl import ClassSecurityInfo
-from Globals import DTMLFile
from Globals import InitializeClass
from zope.interface import implements
@@ -28,7 +27,7 @@
from interfaces import IActionProvider
from interfaces.portal_actions import ActionProvider as z2IActionProvider
from permissions import ManagePortal
-from utils import _dtmldir
+from utils import DTMLResource
class ActionProviderBase:
@@ -42,7 +41,7 @@
_actions = ()
- _actions_form = DTMLFile( 'editToolsActions', _dtmldir )
+ _actions_form = DTMLResource( 'dtml/editToolsActions', globals() )
manage_options = ( { 'label' : 'Actions'
, 'action' : 'manage_editActionsForm'
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/ActionsTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/ActionsTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/ActionsTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,7 +16,6 @@
"""
from AccessControl import ClassSecurityInfo
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.ObjectManager import IFAwareObjectManager
from OFS.OrderedFolder import OrderedFolder
@@ -29,8 +28,8 @@
from interfaces.portal_actions import ActionProvider as z2IActionProvider
from interfaces.portal_actions import portal_actions as z2IActionsTool
from permissions import ManagePortal
-from utils import _dtmldir
from utils import UniqueObject
+from utils import DTMLResource
class ActionsTool(UniqueObject, IFAwareObjectManager, OrderedFolder,
@@ -64,8 +63,9 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainActionsTool', _dtmldir )
- manage_actionProviders = DTMLFile('manageActionProviders', _dtmldir)
+ manage_overview = DTMLResource( 'dtml/explainActionsTool', globals() )
+ manage_actionProviders = DTMLResource( 'dtml/manageActionProviders'
+ , globals())
security.declareProtected(ManagePortal, 'manage_aproviders')
def manage_aproviders(self
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/CMFCatalogAware.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/CMFCatalogAware.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/CMFCatalogAware.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -15,19 +15,19 @@
$Id$
"""
-from zLOG import LOG, PROBLEM
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from ExtensionClass import Base
-from Globals import DTMLFile
from Globals import InitializeClass
+from zLOG import LOG
+from zLOG import PROBLEM
from permissions import AccessContentsInformation
from permissions import ManagePortal
from permissions import ModifyPortalContent
-from utils import _dtmldir
from utils import _getAuthenticatedUser
from utils import getToolByName
+from utils import DTMLResource
from interfaces import ICallableOpaqueItem
from interfaces.IOpaqueItems \
@@ -242,7 +242,7 @@
},
)
- _manage_workflowsTab = DTMLFile('zmi_workflows', _dtmldir)
+ _manage_workflowsTab = DTMLResource('dtml/zmi_workflows', globals())
security.declareProtected(ManagePortal, 'manage_workflowsTab')
def manage_workflowsTab(self, REQUEST, manage_tabs_message=None):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/CachingPolicyManager.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/CachingPolicyManager.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/CachingPolicyManager.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,7 +18,6 @@
from AccessControl import ClassSecurityInfo
from App.Common import rfc1123_date
from DateTime.DateTime import DateTime
-from Globals import DTMLFile
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.SimpleItem import SimpleItem
@@ -32,8 +31,8 @@
from interfaces import ICachingPolicyManager
from interfaces.CachingPolicyManager \
import CachingPolicyManager as z2ICachingPolicyManager
-from utils import _dtmldir
from utils import getToolByName
+from utils import DTMLResource
def createCPContext( content, view_method, keywords, time=None ):
@@ -426,7 +425,7 @@
)
security.declareProtected( ManagePortal, 'manage_cachingPolicies' )
- manage_cachingPolicies = DTMLFile( 'cachingPolicies', _dtmldir )
+ manage_cachingPolicies = DTMLResource( 'dtml/cachingPolicies', globals() )
security.declarePublic( 'listPolicies' )
def listPolicies( self ):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/CatalogTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/CatalogTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/CatalogTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,7 +18,6 @@
from AccessControl import ClassSecurityInfo
from AccessControl.PermissionRole import rolesForPermissionOn
from DateTime import DateTime
-from Globals import DTMLFile
from Globals import InitializeClass
from Products.ZCatalog.ZCatalog import ZCatalog
from zope.interface import implements
@@ -33,11 +32,11 @@
from permissions import ManagePortal
from permissions import View
from utils import _checkPermission
-from utils import _dtmldir
from utils import _getAuthenticatedUser
from utils import _mergedLocalRoles
from utils import getToolByName
from utils import UniqueObject
+from utils import DTMLResource
class IndexableObjectWrapper:
@@ -101,7 +100,7 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainCatalogTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainCatalogTool', globals() )
#
# 'portal_catalog' interface methods
@@ -201,7 +200,7 @@
def __url(self, ob):
return '/'.join( ob.getPhysicalPath() )
- manage_catalogFind = DTMLFile( 'catalogFind', _dtmldir )
+ manage_catalogFind = DTMLResource( 'dtml/catalogFind', globals() )
def catalog_object(self, obj, uid=None, idxs=None, update_metadata=1,
pghandler=None):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/ContentTypeRegistry.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/ContentTypeRegistry.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/ContentTypeRegistry.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,7 +18,6 @@
import re, os, urllib
from AccessControl import ClassSecurityInfo
-from Globals import DTMLFile
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.SimpleItem import SimpleItem
@@ -32,8 +31,8 @@
from interfaces.ContentTypeRegistry \
import ContentTypeRegistryPredicate as z2IContentTypeRegistryPredicate
from permissions import ManagePortal
-from utils import _dtmldir
from utils import getToolByName
+from utils import DTMLResource
class MajorMinorPredicate( SimpleItem ):
@@ -120,7 +119,7 @@
return self.PREDICATE_TYPE
security.declareProtected( ManagePortal, 'predicateWidget' )
- predicateWidget = DTMLFile( 'majorMinorWidget', _dtmldir )
+ predicateWidget = DTMLResource( 'dtml/majorMinorWidget', globals() )
InitializeClass( MajorMinorPredicate )
@@ -183,7 +182,7 @@
return self.PREDICATE_TYPE
security.declareProtected( ManagePortal, 'predicateWidget' )
- predicateWidget = DTMLFile( 'extensionWidget', _dtmldir )
+ predicateWidget = DTMLResource( 'dtml/extensionWidget', globals() )
InitializeClass( ExtensionPredicate )
@@ -240,7 +239,7 @@
return self.PREDICATE_TYPE
security.declareProtected( ManagePortal, 'predicateWidget' )
- predicateWidget = DTMLFile( 'patternWidget', _dtmldir )
+ predicateWidget = DTMLResource( 'dtml/patternWidget', globals() )
InitializeClass( MimeTypeRegexPredicate )
@@ -300,7 +299,7 @@
return self.PREDICATE_TYPE
security.declareProtected( ManagePortal, 'predicateWidget' )
- predicateWidget = DTMLFile( 'patternWidget', _dtmldir )
+ predicateWidget = DTMLResource( 'dtml/patternWidget', globals() )
InitializeClass( NameRegexPredicate )
@@ -356,7 +355,7 @@
return map( lambda x: x[0], _predicate_types )
security.declareProtected( ManagePortal, 'manage_predicates' )
- manage_predicates = DTMLFile( 'registryPredList', _dtmldir )
+ manage_predicates = DTMLResource( 'dtml/registryPredList', globals() )
security.declareProtected( ManagePortal, 'doAddPredicate' )
def doAddPredicate( self, predicate_id, predicate_type, REQUEST ):
@@ -426,7 +425,7 @@
)
security.declareProtected( ManagePortal, 'manage_testRegistry' )
- manage_testRegistry = DTMLFile( 'registryTest', _dtmldir )
+ manage_testRegistry = DTMLResource( 'dtml/registryTest', globals() )
security.declareProtected( ManagePortal, 'doTestRegistry' )
def doTestRegistry( self, name, content_type, body, REQUEST ):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/DirectoryView.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/DirectoryView.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/DirectoryView.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,7 +16,9 @@
"""
import re
-from os import path, listdir, stat
+from os import path
+from os import listdir
+from os import stat
from pkg_resources import resource_listdir
from pkg_resources import resource_isdir
from pkg_resources import resource_string
@@ -26,10 +28,7 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_inner, aq_parent
from Globals import DevelopmentMode
-from Globals import DTMLFile
-from Globals import HTMLFile
from Globals import InitializeClass
-from Globals import package_home
from Globals import Persistent
from OFS.Folder import Folder
from OFS.ObjectManager import bad_id
@@ -40,8 +39,8 @@
from FSObject import BadFile
from permissions import AccessContentsInformation
from permissions import ManagePortal
-from utils import _dtmldir
from utils import normalize
+from utils import DTMLResource
__reload_module__ = 0
@@ -705,7 +704,8 @@
delattr(d['_real'], name)
security.declareProtected(ManagePortal, 'manage_propertiesForm')
- manage_propertiesForm = DTMLFile( 'dirview_properties', _dtmldir )
+ manage_propertiesForm = DTMLResource( 'dtml/dirview_properties'
+ , globals() )
security.declareProtected(ManagePortal, 'manage_properties')
def manage_properties( self, dirpath, REQUEST=None ):
@@ -744,7 +744,8 @@
InitializeClass(DirectoryViewSurrogate)
-manage_addDirectoryViewForm = HTMLFile('dtml/addFSDirView', globals())
+#manage_addDirectoryViewForm = HTMLFile('dtml/addFSDirView', globals())
+manage_addDirectoryViewForm = DTMLResource('dtml/addFSDirView', globals())
def createDirectoryView(parent, minimal_fp, id=None):
""" Add either a DirectoryView or a derivative object.
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/DiscussionTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/DiscussionTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/DiscussionTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -15,10 +15,10 @@
$Id$
"""
+from AccessControl import ClassSecurityInfo
+from Acquisition import Implicit
+from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
-from Globals import InitializeClass, DTMLFile
-from Acquisition import Implicit
-from AccessControl import ClassSecurityInfo
from zope.interface import implements
from ActionProviderBase import ActionProviderBase
@@ -31,9 +31,9 @@
from interfaces.Discussions import OldDiscussable as z2IOldstyleDiscussable
from interfaces.portal_discussion \
import oldstyle_portal_discussion as z2IOldstyleDiscussionTool
-from utils import _dtmldir
from utils import getToolByName
from utils import UniqueObject
+from utils import DTMLResource
class OldDiscussable(Implicit):
@@ -136,7 +136,7 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainDiscussionTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainDiscussionTool', globals() )
#
# 'portal_discussion' interface methods
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSDTMLMethod.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSDTMLMethod.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSDTMLMethod.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,11 +16,12 @@
"""
from pkg_resources import resource_string
-import Globals
from AccessControl import ClassSecurityInfo, getSecurityManager
from AccessControl.DTML import RestrictedDTML
from AccessControl.Role import RoleManager
from OFS.Cache import Cacheable
+from Globals import HTML
+from Globals import InitializeClass
from OFS.DTMLMethod import DTMLMethod, decapitate, guess_content_type
from DirectoryView import registerFileExtension
@@ -29,14 +30,14 @@
from permissions import FTPAccess
from permissions import View
from permissions import ViewManagementScreens
-from utils import _dtmldir
from utils import _setCacheHeaders
+from utils import DTMLResource
_marker = [] # Create a new marker object.
-class FSDTMLMethod(RestrictedDTML, RoleManager, FSObject, Globals.HTML):
+class FSDTMLMethod(RestrictedDTML, RoleManager, FSObject, HTML):
"""FSDTMLMethods act like DTML methods but are not directly
modifiable from the management interface."""
@@ -61,7 +62,7 @@
security.declareObjectProtected(View)
security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile('custdtml', _dtmldir)
+ manage_main = DTMLResource('dtml/custdtml', globals())
_reading = 0
@@ -91,7 +92,7 @@
def read_raw(self):
if not self._reading:
self._updateFromFS()
- return Globals.HTML.read_raw(self)
+ return HTML.read_raw(self)
#### The following is mainly taken from OFS/DTMLMethod.py ###
@@ -121,7 +122,7 @@
security=getSecurityManager()
security.addContext(self)
try:
- r = Globals.HTML.__call__(self, client, REQUEST, **kw)
+ r = HTML.__call__(self, client, REQUEST, **kw)
if client is None:
# Called as subtemplate, so don't need error propagation!
@@ -189,7 +190,7 @@
security.declareProtected(ViewManagementScreens, 'manage_haveProxy')
manage_haveProxy = DTMLMethod.manage_haveProxy.im_func
-Globals.InitializeClass(FSDTMLMethod)
+InitializeClass(FSDTMLMethod)
registerFileExtension('dtml', FSDTMLMethod)
registerMetaType('DTML Method', FSDTMLMethod)
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSFile.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSFile.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSFile.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,7 +16,7 @@
"""
import os
-import Globals
+from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from DateTime import DateTime
from OFS.Cache import Cacheable
@@ -30,8 +30,9 @@
from permissions import FTPAccess
from permissions import View
from permissions import ViewManagementScreens
-from utils import _dtmldir
-from utils import _setCacheHeaders, _ViewEmulator
+from utils import _setCacheHeaders
+from utils import _ViewEmulator
+from utils import DTMLResource
class FSFile(FSObject):
@@ -56,7 +57,7 @@
fullname, properties)
security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile('custfile', _dtmldir)
+ manage_main = DTMLResource('dtml/custfile', globals())
content_type = 'unknown/unknown'
def _createZODBClone(self):
@@ -165,7 +166,7 @@
security.declareProtected(FTPAccess, 'manage_FTPget')
manage_FTPget = index_html
-Globals.InitializeClass(FSFile)
+InitializeClass(FSFile)
registerFileExtension('doc', FSFile)
registerFileExtension('pdf', FSFile)
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSImage.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSImage.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSImage.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -15,13 +15,13 @@
$Id$
"""
-import Globals
+from AccessControl import ClassSecurityInfo
from DateTime import DateTime
-from AccessControl import ClassSecurityInfo
-from webdav.common import rfc1123_date
+from Globals import InitializeClass
from OFS.Cache import Cacheable
from OFS.Image import Image
from OFS.Image import getImageInfo
+from webdav.common import rfc1123_date
from permissions import FTPAccess
from permissions import View
@@ -29,9 +29,9 @@
from DirectoryView import registerFileExtension
from DirectoryView import registerMetaType
from FSObject import FSObject
-from utils import _dtmldir
from utils import _ViewEmulator
from utils import _setCacheHeaders
+from utils import DTMLResource
class FSImage(FSObject):
@@ -57,7 +57,7 @@
fullname, properties)
security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile('custimage', _dtmldir)
+ manage_main = DTMLResource('dtml/custimage', globals())
content_type = 'unknown/unknown'
def _createZODBClone(self):
@@ -158,7 +158,7 @@
security.declareProtected(FTPAccess, 'manage_FTPget')
manage_FTPget = index_html
-Globals.InitializeClass(FSImage)
+InitializeClass(FSImage)
registerFileExtension('gif', FSImage)
registerFileExtension('jpg', FSImage)
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSPageTemplate.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSPageTemplate.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSPageTemplate.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,11 +18,13 @@
from pkg_resources import resource_string
import re
-import Globals
-from AccessControl import getSecurityManager, ClassSecurityInfo
+from Globals import InitializeClass
+from AccessControl import getSecurityManager
+from AccessControl import ClassSecurityInfo
from OFS.Cache import Cacheable
from Products.PageTemplates.PageTemplate import PageTemplate
-from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate, Src
+from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
+from Products.PageTemplates.ZopePageTemplate import Src
from Shared.DC.Scripts.Script import Script
from DirectoryView import registerFileExtension
@@ -31,7 +33,9 @@
from permissions import FTPAccess
from permissions import View
from permissions import ViewManagementScreens
-from utils import _setCacheHeaders, _checkConditionalGET
+from utils import _setCacheHeaders
+from utils import _checkConditionalGET
+from utils import DTMLResource
xml_detect_re = re.compile('^\s*<\?xml\s+(?:[^>]*?encoding=["\']([^"\'>]+))?')
_marker = [] # Create a new marker object.
@@ -58,7 +62,7 @@
security.declareObjectProtected(View)
security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile('dtml/custpt', globals())
+ manage_main = DTMLResource('dtml/custpt', globals())
# Declare security for unprotected PageTemplate methods.
security.declarePrivate('pt_edit', 'write')
@@ -222,7 +226,7 @@
setattr(FSPageTemplate, 'source.xml', FSPageTemplate.source_dot_xml)
setattr(FSPageTemplate, 'source.html', FSPageTemplate.source_dot_xml)
-Globals.InitializeClass(FSPageTemplate)
+InitializeClass(FSPageTemplate)
registerFileExtension('pt', FSPageTemplate)
registerFileExtension('zpt', FSPageTemplate)
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSPropertiesObject.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSPropertiesObject.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSPropertiesObject.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -14,9 +14,10 @@
$Id$
"""
-import Globals
from AccessControl import ClassSecurityInfo
from Acquisition import ImplicitAcquisitionWrapper
+from Globals import DevelopmentMode
+from Globals import InitializeClass
from OFS.Folder import Folder
from OFS.PropertyManager import PropertyManager
from ZPublisher.Converters import get_converter
@@ -25,7 +26,7 @@
from DirectoryView import registerMetaType
from FSObject import FSObject
from permissions import ViewManagementScreens
-from utils import _dtmldir
+from utils import DTMLResource
class FSPropertiesObject (FSObject, PropertyManager):
"""FSPropertiesObjects simply hold properties."""
@@ -37,7 +38,7 @@
security = ClassSecurityInfo()
security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile('custprops', _dtmldir)
+ manage_main = DTMLResource('dtml/custprops', globals())
# Declare all (inherited) mutating methods private.
security.declarePrivate('manage_addProperty')
@@ -123,14 +124,14 @@
% (lino,fp,line) )
self._properties = tuple(map)
- if Globals.DevelopmentMode:
+ if DevelopmentMode:
# Provide an opportunity to update the properties.
def __of__(self, parent):
self = ImplicitAcquisitionWrapper(self, parent)
self._updateFromFS()
return self
-Globals.InitializeClass(FSPropertiesObject)
+InitializeClass(FSPropertiesObject)
registerFileExtension('props', FSPropertiesObject)
registerMetaType('Properties Object', FSPropertiesObject)
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSPythonScript.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSPythonScript.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSPythonScript.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -20,7 +20,6 @@
from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
from ComputedAttribute import ComputedAttribute
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.Cache import Cacheable
from Products.PythonScripts.PythonScript import PythonScript
@@ -32,8 +31,8 @@
from permissions import FTPAccess
from permissions import View
from permissions import ViewManagementScreens
-from utils import _dtmldir
from utils import expandpath
+from utils import DTMLResource
_marker = []
@@ -73,7 +72,7 @@
'ZBindingsHTML_editAction')
security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = DTMLFile('custpy', _dtmldir)
+ manage_main = DTMLResource('dtml/custpy', globals())
def _createZODBClone(self):
"""Create a ZODB (editable) equivalent of this object."""
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSSTXMethod.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSSTXMethod.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSSTXMethod.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -15,7 +15,8 @@
$Id$
"""
-import Globals
+from Globals import HTML
+from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from StructuredText.StructuredText import HTML
@@ -25,8 +26,8 @@
from DirectoryView import registerFileExtension
from DirectoryView import registerMetaType
from FSObject import FSObject
-from utils import _dtmldir
from utils import expandpath
+from utils import DTMLResource
class FSSTXMethod( FSObject ):
@@ -52,7 +53,7 @@
security.declareObjectProtected( View )
security.declareProtected( ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile( 'custstx', _dtmldir )
+ manage_main = DTMLResource( 'dtml/custstx', globals() )
#
# FSObject interface
@@ -92,7 +93,7 @@
self._v_cooked = HTML(self.raw, level=1, header=0)
return self._v_cooked
- _default_template = Globals.HTML( """\
+ _default_template = HTML( """\
<dtml-var standard_html_header>
<div class="Desktop">
<dtml-var cooked>
@@ -145,7 +146,7 @@
"""
return self.raw
-Globals.InitializeClass( FSSTXMethod )
+InitializeClass( FSSTXMethod )
registerFileExtension( 'stx', FSSTXMethod )
registerMetaType( 'STX Method', FSSTXMethod )
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/FSZSQLMethod.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/FSZSQLMethod.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/FSZSQLMethod.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -15,22 +15,26 @@
$Id$
"""
-import Globals
+from Globals import DevelopmentMode
+from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Acquisition import ImplicitAcquisitionWrapper
from Products.ZSQLMethods.SQL import SQL
-from zLOG import LOG, ERROR
+from zLOG import ERROR
+from zLOG import LOG
from DirectoryView import registerFileExtension
from DirectoryView import registerMetaType
from FSObject import FSObject
from permissions import View
from permissions import ViewManagementScreens
-from utils import _dtmldir
+from utils import DTMLResource
class FSZSQLMethod(SQL, FSObject):
- """FSZSQLMethods act like Z SQL Methods but are not directly
- modifiable from the management interface."""
+ """ FSZSQLMethods act like Z SQL Methods loaded from the filesystem.
+
+ o They are not, however, directly modifiable from the management interface.
+ """
meta_type = 'Filesystem Z SQL Method'
@@ -48,11 +52,15 @@
security.declareObjectProtected(View)
# Make mutators private
- security.declarePrivate('manage_main','manage_edit','manage_advanced','manage_advancedForm')
- manage=None
+ security.declarePrivate('manage_main',
+ 'manage_edit',
+ 'manage_advanced',
+ 'manage_advancedForm',
+ )
+ manage = None
security.declareProtected(ViewManagementScreens, 'manage_customise')
- manage_customise = Globals.DTMLFile('custzsql', _dtmldir)
+ manage_customise = DTMLResource('dtml/custzsql', globals())
def __init__(self, id, package=None, entry_subpath=None, filepath=None,
fullname=None, properties=None):
@@ -125,7 +133,7 @@
# do we need to do anything on reparse?
- if Globals.DevelopmentMode:
+ if DevelopmentMode:
# Provide an opportunity to update the properties.
def __of__(self, parent):
try:
@@ -140,7 +148,7 @@
error=sys.exc_info())
raise
-Globals.InitializeClass(FSZSQLMethod)
+InitializeClass(FSZSQLMethod)
registerFileExtension('zsql', FSZSQLMethod)
registerMetaType('Z SQL Method', FSZSQLMethod)
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/MemberDataTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/MemberDataTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/MemberDataTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,9 +16,10 @@
"""
from AccessControl import ClassSecurityInfo
-from Acquisition import aq_inner, aq_parent, aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
+from Acquisition import aq_base
from BTrees.OOBTree import OOBTree
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.PropertyManager import PropertyManager
from OFS.SimpleItem import SimpleItem
@@ -35,9 +36,9 @@
from permissions import ManagePortal
from permissions import SetOwnProperties
from permissions import ViewManagementScreens
-from utils import _dtmldir
from utils import getToolByName
from utils import UniqueObject
+from utils import DTMLResource
_marker = [] # Create a new marker object.
@@ -75,10 +76,10 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainMemberDataTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainMemberDataTool', globals() )
security.declareProtected(ViewManagementScreens, 'manage_showContents')
- manage_showContents = DTMLFile('memberdataContents', _dtmldir )
+ manage_showContents = DTMLResource( 'dtml/memberdataContents', globals() )
def __init__(self):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/MembershipTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/MembershipTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/MembershipTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -20,7 +20,6 @@
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
-from Globals import DTMLFile
from Globals import InitializeClass
from Globals import MessageDialog
from Globals import PersistentMapping
@@ -42,10 +41,10 @@
from permissions import SetOwnPassword
from permissions import View
from utils import _checkPermission
-from utils import _dtmldir
from utils import _getAuthenticatedUser
from utils import getToolByName
from utils import UniqueObject
+from utils import DTMLResource
class MembershipTool(UniqueObject, Folder, ActionProviderBase):
@@ -78,13 +77,13 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainMembershipTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainMembershipTool', globals() )
#
# 'portal_membership' interface methods
#
security.declareProtected(ManagePortal, 'manage_mapRoles')
- manage_mapRoles = DTMLFile('membershipRolemapping', _dtmldir )
+ manage_mapRoles = DTMLResource('dtml/membershipRolemapping', globals() )
security.declareProtected(SetOwnPassword, 'setPassword')
def setPassword(self, password, domains=None):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/PortalFolder.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/PortalFolder.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/PortalFolder.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -21,8 +21,9 @@
from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
-from Acquisition import aq_parent, aq_inner, aq_base
-from Globals import DTMLFile
+from Acquisition import aq_parent
+from Acquisition import aq_inner
+from Acquisition import aq_base
from Globals import InitializeClass
from OFS.OrderSupport import OrderSupport
from OFS.Folder import Folder
@@ -44,6 +45,7 @@
from permissions import View
from utils import _checkPermission
from utils import getToolByName
+from utils import DTMLResource
class PortalFolderBase(DynamicType, CMFCatalogAware, Folder):
@@ -621,4 +623,4 @@
return '; '.join(self.description)
manage_addPortalFolder = PortalFolder.manage_addPortalFolder.im_func
-manage_addPortalFolderForm = DTMLFile( 'folderAdd', globals() )
+manage_addPortalFolderForm = DTMLResource( 'folderAdd', globals() )
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/RegistrationTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/RegistrationTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/RegistrationTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -19,7 +19,6 @@
from random import choice
from AccessControl import ClassSecurityInfo
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
from zope.interface import implements
@@ -32,11 +31,11 @@
from permissions import MailForgottenPassword
from permissions import ManagePortal
from utils import _checkPermission
-from utils import _dtmldir
from utils import _limitGrantedRoles
from utils import getToolByName
from utils import MessageID as _
from utils import UniqueObject
+from utils import DTMLResource
class RegistrationTool(UniqueObject, SimpleItem, ActionProviderBase):
@@ -64,10 +63,11 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainRegistrationTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainRegistrationTool', globals() )
security.declareProtected(ManagePortal, 'manage_configuration')
- manage_configuration = DTMLFile('configureRegistrationTool', _dtmldir)
+ manage_configuration = DTMLResource( 'dtml/configureRegistrationTool'
+ , globals())
security.declareProtected(ManagePortal, 'manage_editIDPattern')
def manage_editIDPattern(self, pattern, REQUEST=None):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/SkinsTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/SkinsTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/SkinsTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,7 +18,6 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from DateTime import DateTime
-from Globals import DTMLFile
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.DTMLMethod import DTMLMethod
@@ -39,9 +38,9 @@
from permissions import ManagePortal
from permissions import View
from SkinsContainer import SkinsContainer
-from utils import _dtmldir
from utils import getToolByName
from utils import UniqueObject
+from utils import DTMLResource
def modifiedOptions():
@@ -96,20 +95,22 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainSkinsTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainSkinsTool', globals() )
security.declareProtected(ManagePortal, 'manage_propertiesForm')
- manage_propertiesForm = DTMLFile('dtml/skinProps', globals())
+ manage_propertiesForm = DTMLResource( 'dtml/skinProps', globals() )
# the following two methods override those in FindSupport, to
# support marking of objects used in specific skins
security.declareProtected(ManagePortal, 'manage_findResult')
- manage_findResult = DTMLFile('findResult', _dtmldir,
- management_view='Find')
+ manage_findResult = DTMLResource( 'dtml/findResult', globals()
+ , management_view='Find'
+ )
security.declareProtected(ManagePortal, 'manage_findForm')
- manage_findForm = DTMLFile('findForm', _dtmldir,
- management_view='Find')
+ manage_findForm = DTMLResource( 'dtml/findForm', globals()
+ , management_view='Find'
+ )
@@ -145,15 +146,18 @@
if REQUEST is not None:
return self.manage_propertiesForm(
- self, REQUEST, management_view='Properties', manage_tabs_message='Skins changed.')
+ self
+ , REQUEST
+ , management_view='Properties'
+ , manage_tabs_message='Skins changed.'
+ )
security.declareProtected(ManagePortal, 'isFirstInSkin')
def isFirstInSkin(self, template_path, skin=None):
+ """ Is the specified template the one that would get returned
+ from the current skin?
"""
- Is the specified template the one that would get returned from the current
- skin?
- """
if skin is None or skin == 'None':
skin = self.getDefaultSkin()
template = self.restrictedTraverse(template_path)
@@ -190,7 +194,11 @@
self.cookie_persistence = cookie_persistence and 1 or 0
if REQUEST is not None:
return self.manage_propertiesForm(
- self, REQUEST, management_view='Properties', manage_tabs_message='Properties changed.')
+ self
+ , REQUEST
+ , management_view='Properties'
+ , manage_tabs_message='Properties changed.'
+ )
security.declarePrivate('PUT_factory')
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/TypesTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/TypesTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/TypesTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -24,11 +24,9 @@
from AccessControl import getSecurityManager
from Acquisition import aq_base
from Acquisition import aq_get
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.Folder import Folder
from OFS.ObjectManager import IFAwareObjectManager
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zLOG import LOG, ERROR
from zope.i18nmessageid import MessageID
from zope.interface import implements
@@ -48,13 +46,13 @@
from permissions import ManagePortal
from permissions import View
from utils import _checkPermission
-from utils import _dtmldir
-from utils import _wwwdir
from utils import cookString
from utils import getActionContext
from utils import getToolByName
from utils import SimpleItemWithProperties
from utils import UniqueObject
+from utils import DTMLResource
+from utils import PageTemplateResource
_marker = [] # Create a new marker.
@@ -163,7 +161,8 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_aliases')
- manage_aliases = PageTemplateFile( 'typeinfoAliases.zpt', _wwwdir )
+ manage_aliases = PageTemplateResource( 'www/typeinfoAliases.zpt'
+ , globals() )
security.declareProtected(ManagePortal, 'manage_setMethodAliases')
def manage_setMethodAliases(self, REQUEST):
@@ -618,7 +617,7 @@
InitializeClass( ScriptableTypeInformation )
-_addTypeInfo_template = PageTemplateFile('addTypeInfo.zpt', _wwwdir)
+_addTypeInfo_template = PageTemplateResource('addTypeInfo.zpt', globals())
def manage_addFactoryTIForm(dispatcher, REQUEST):
""" Get the add form for factory-based type infos.
@@ -735,10 +734,10 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainTypesTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainTypesTool', globals() )
security.declareProtected(ManagePortal, 'manage_aliases')
- manage_aliases = PageTemplateFile( 'typesAliases.zpt', _wwwdir )
+ manage_aliases = PageTemplateResource( 'typesAliases.zpt', globals() )
#
# ObjectManager methods
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/URLTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/URLTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/URLTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,7 +18,6 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_inner
from Acquisition import aq_parent
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
from zope.interface import implements
@@ -28,8 +27,8 @@
from interfaces.portal_url import portal_url as z2IURLTool
from permissions import ManagePortal
from permissions import View
-from utils import _dtmldir
from utils import UniqueObject
+from utils import DTMLResource
class URLTool(UniqueObject, SimpleItem, ActionProviderBase):
@@ -58,7 +57,7 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile('explainURLTool', _dtmldir)
+ manage_overview = DTMLResource('dtml/explainURLTool', globals())
#
# 'portal_url' interface methods
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/UndoTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/UndoTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/UndoTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,7 +16,6 @@
"""
from AccessControl import ClassSecurityInfo
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
from zope.interface import implements
@@ -28,9 +27,9 @@
from permissions import ListUndoableChanges
from permissions import ManagePortal
from utils import _checkPermission
-from utils import _dtmldir
from utils import _getAuthenticatedUser
from utils import UniqueObject
+from utils import DTMLResource
class UndoTool(UniqueObject, SimpleItem, ActionProviderBase):
@@ -55,7 +54,7 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainUndoTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainUndoTool', globals() )
#
# 'portal_undo' interface methods
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/WorkflowTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/WorkflowTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/WorkflowTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -19,8 +19,9 @@
from warnings import warn
from AccessControl import ClassSecurityInfo
-from Acquisition import aq_base, aq_inner, aq_parent
-from Globals import DTMLFile
+from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.Folder import Folder
@@ -30,9 +31,9 @@
from interfaces import IWorkflowTool
from interfaces.portal_workflow import portal_workflow as z2IWorkflowTool
from permissions import ManagePortal
-from utils import _dtmldir
from utils import getToolByName
from utils import UniqueObject
+from utils import DTMLResource
from WorkflowCore import ObjectDeleted
from WorkflowCore import ObjectMoved
from WorkflowCore import WorkflowException
@@ -88,9 +89,9 @@
# ZMI methods
#
security.declareProtected( ManagePortal, 'manage_overview' )
- manage_overview = DTMLFile( 'explainWorkflowTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainWorkflowTool', globals() )
- _manage_addWorkflowForm = DTMLFile('addWorkflow', _dtmldir)
+ _manage_addWorkflowForm = DTMLResource('dtml/addWorkflow', globals())
security.declareProtected( ManagePortal, 'manage_addWorkflowForm')
def manage_addWorkflowForm(self, REQUEST):
@@ -121,7 +122,7 @@
'action': 'manage_addWorkflowForm',
'permission': ManagePortal },)
- _manage_selectWorkflows = DTMLFile('selectWorkflows', _dtmldir)
+ _manage_selectWorkflows = DTMLResource('dtml/selectWorkflows', globals())
security.declareProtected( ManagePortal, 'manage_selectWorkflows')
def manage_selectWorkflows(self, REQUEST, manage_tabs_message=None):
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/fiveactionstool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/fiveactionstool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/fiveactionstool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -17,7 +17,6 @@
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
-from Globals import DTMLFile
from OFS.SimpleItem import SimpleItem
from ActionInformation import ActionInformation
@@ -25,7 +24,7 @@
from Expression import Expression
from permissions import ManagePortal
from utils import UniqueObject
-from utils import _dtmldir
+from utils import DTMLResource
from zope.app.publisher.browser.globalbrowsermenuservice import \
globalBrowserMenuService
@@ -55,7 +54,7 @@
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile('explainFiveActionsTool', _dtmldir)
+ manage_overview = DTMLResource('dtml/explainFiveActionsTool', globals())
#
# ActionProvider
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/interfaces/_tools.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/interfaces/_tools.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/interfaces/_tools.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -341,7 +341,7 @@
def predicateWidget():
""" Return a snippet of HTML suitable for editing the predicate.
- o This method may be defined via DTMLFile or PageTemplateFile
+ o This method may be defined via DTMLResource or PageTemplateResource
(the tool will call it appropriately, if it is DTML).
o The snippet should arrange for values to be marshalled by
Modified: CMF/branches/tseaver-pkg_resources/CMFCore/utils.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFCore/utils.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFCore/utils.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -34,10 +34,8 @@
from DateTime import DateTime
from ExtensionClass import Base
from Globals import HTMLFile
-from Globals import ImageFile
from Globals import InitializeClass
from Globals import MessageDialog
-from Globals import package_home
from Globals import UNIQUE
from OFS.misc_ import misc_ as misc_images
from OFS.misc_ import Misc_ as MiscImage
@@ -53,12 +51,20 @@
from exceptions import NotFound
from warnings import warn
+try:
+ import Products.Basket
+except ImportError: # no egg support :-<
+ from Globals import ImageFile as ImageResource
+ from Globals import DTMLFile as DTMLResource
+ from Products.PageTemplates.PageTemplateFile \
+ import PageTemplateFile as PageTemplateResource
+else:
+ from Globals import ImageResource
+ from Globals import DTMLResource
+ from Products.PageTemplates import PageTemplateResource
security = ModuleSecurityInfo( 'Products.CMFCore.utils' )
-_dtmldir = os_path.join( package_home( globals() ), 'dtml' )
-_wwwdir = os_path.join( package_home( globals() ), 'www' )
-
#
# Simple utility functions, callable from restricted code.
#
@@ -695,7 +701,7 @@
pid = modname.split('.')[1]
name = os_path.split(iconspec)[1]
klass.icon = 'misc_/%s/%s' % (pid, name)
- icon = ImageFile(iconspec, _prefix)
+ icon = ImageResource(iconspec, _prefix)
icon.__roles__=None
if not hasattr(misc_images, pid):
setattr(misc_images, pid, MiscImage(pid, {}))
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/DiscussionTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/DiscussionTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/DiscussionTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -17,7 +17,6 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
from zope.interface import implements
@@ -31,6 +30,7 @@
import portal_discussion as z2IDiscussionTool
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import UniqueObject
+from Products.CMFCore.utils import DTMLResource
from DiscussionItem import DiscussionItemContainer
from exceptions import AccessControl_Unauthorized
@@ -38,7 +38,6 @@
from permissions import ManagePortal
from permissions import ModifyPortalContent
from permissions import ReplyToItem
-from utils import _dtmldir
class DiscussionTool( UniqueObject, SimpleItem, ActionProviderBase ):
@@ -63,7 +62,7 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainDiscussionTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainDiscussionTool', globals() )
#
# 'portal_discussion' interface methods
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/Document.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/Document.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/Document.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -20,7 +20,6 @@
from AccessControl import getSecurityManager
from Acquisition import aq_base
from DocumentTemplate.DT_Util import html_quote
-from Globals import DTMLFile
from Globals import InitializeClass
from StructuredText.StructuredText import HTML
from zope.interface import implements
@@ -28,6 +27,7 @@
from Products.CMFCore.PortalContent import PortalContent
from Products.CMFCore.utils import contributorsplitter
from Products.CMFCore.utils import keywordsplitter
+from Products.CMFCore.utils import DTMLResource
from DublinCore import DefaultDublinCoreImpl
from exceptions import EditingConflict
@@ -38,7 +38,6 @@
from interfaces.Document import IMutableDocument as z2IMutableDocument
from permissions import ModifyPortalContent
from permissions import View
-from utils import _dtmldir
from utils import bodyfinder
from utils import formatRFC822Headers
from utils import html_headcheck
@@ -86,7 +85,7 @@
self.setFormat( text_format )
security.declareProtected(ModifyPortalContent, 'manage_edit')
- manage_edit = DTMLFile('zmi_editDocument', _dtmldir)
+ manage_edit = DTMLResource('dtml/zmi_editDocument', globals())
security.declareProtected(ModifyPortalContent, 'manage_editDocument')
def manage_editDocument( self, text, text_format, file='', REQUEST=None ):
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/DublinCore.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/DublinCore.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/DublinCore.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,7 +18,6 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from DateTime.DateTime import DateTime
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.PropertyManager import PropertyManager
from zope.interface import implements
@@ -33,11 +32,11 @@
from Products.CMFCore.interfaces.DublinCore \
import MutableDublinCore as z2IMutableDublinCore
from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import DTMLResource
from permissions import ModifyPortalContent
from permissions import View
from utils import tuplize
-from utils import _dtmldir
from utils import semi_split
_marker=[]
@@ -451,7 +450,7 @@
self.setRights( rights )
security.declareProtected(ModifyPortalContent, 'manage_metadata')
- manage_metadata = DTMLFile( 'zmi_metadata', _dtmldir )
+ manage_metadata = DTMLResource( 'dtml/zmi_metadata', globals() )
security.declareProtected(ModifyPortalContent, 'manage_editMetadata')
def manage_editMetadata( self
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/Link.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/Link.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/Link.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -19,18 +19,17 @@
import transaction
from AccessControl import ClassSecurityInfo
-from Globals import DTMLFile
from Globals import InitializeClass
from Products.CMFCore.PortalContent import PortalContent
from Products.CMFCore.utils import contributorsplitter
from Products.CMFCore.utils import keywordsplitter
+from Products.CMFCore.utils import DTMLResource
from DublinCore import DefaultDublinCoreImpl
from exceptions import ResourceLockedError
from permissions import ModifyPortalContent
from permissions import View
-from utils import _dtmldir
from utils import formatRFC822Headers
from utils import parseHeadersBody
@@ -77,7 +76,7 @@
self.format=self.URL_FORMAT
security.declareProtected(ModifyPortalContent, 'manage_edit')
- manage_edit = DTMLFile( 'zmi_editLink', _dtmldir )
+ manage_edit = DTMLResource( 'dtml/zmi_editLink', globals() )
security.declareProtected(ModifyPortalContent, 'manage_editLink')
def manage_editLink( self, remote_url, REQUEST=None ):
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/MembershipTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/MembershipTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/MembershipTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -19,12 +19,12 @@
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
-from Globals import DTMLFile
from Globals import InitializeClass
from zope.interface import implements
from Products.CMFCore.ActionProviderBase import ActionProviderBase
from Products.CMFCore.MembershipTool import MembershipTool as BaseTool
+from Products.CMFCore.utils import DTMLResource
from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.utils import _getAuthenticatedUser
from Products.CMFCore.utils import getToolByName
@@ -37,7 +37,6 @@
from permissions import ManagePortal
from permissions import ManageUsers
from permissions import View
-from utils import _dtmldir
DEFAULT_MEMBER_CONTENT = """\
@@ -68,10 +67,10 @@
# ZMI methods
#
security.declareProtected( ManagePortal, 'manage_overview' )
- manage_overview = DTMLFile( 'explainMembershipTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainMembershipTool', globals() )
security.declareProtected(ManagePortal, 'manage_mapRoles')
- manage_mapRoles = DTMLFile('membershipRolemapping', _dtmldir )
+ manage_mapRoles = DTMLResource('dtml/membershipRolemapping', globals() )
security.declareProtected(ManagePortal, 'manage_setMembersFolderById')
def manage_setMembersFolderById(self, id='', REQUEST=None):
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/MetadataTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/MetadataTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/MetadataTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -17,7 +17,6 @@
from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
-from Globals import DTMLFile
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.SimpleItem import SimpleItem
@@ -28,12 +27,12 @@
from Products.CMFCore.interfaces.portal_metadata \
import portal_metadata as z2IMetadataTool
from Products.CMFCore.utils import UniqueObject
+from Products.CMFCore.utils import DTMLResource
from exceptions import MetadataError
from permissions import ManagePortal
from permissions import ModifyPortalContent
from permissions import View
-from utils import _dtmldir
class MetadataElementPolicy( SimpleItem ):
@@ -260,10 +259,10 @@
)
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainMetadataTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainMetadataTool', globals() )
security.declareProtected(ManagePortal, 'propertiesForm')
- propertiesForm = DTMLFile( 'metadataProperties', _dtmldir )
+ propertiesForm = DTMLResource( 'dtml/metadataProperties', globals() )
security.declareProtected(ManagePortal, 'editProperties')
def editProperties( self
@@ -289,7 +288,8 @@
)
security.declareProtected(ManagePortal, 'elementPoliciesForm')
- elementPoliciesForm = DTMLFile( 'metadataElementPolicies', _dtmldir )
+ elementPoliciesForm = DTMLResource( 'dtml/metadataElementPolicies'
+ , globals() )
security.declareProtected(ManagePortal, 'addElementPolicy')
def addElementPolicy( self
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/PropertiesTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/PropertiesTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/PropertiesTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -17,7 +17,7 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_inner, aq_parent
-from Globals import InitializeClass, DTMLFile
+from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
from zope.interface import implements
@@ -26,11 +26,10 @@
from Products.CMFCore.interfaces.portal_properties \
import portal_properties as z2IPropertiesTool
from Products.CMFCore.utils import UniqueObject
+from Products.CMFCore.utils import DTMLResource
from permissions import ManagePortal
-from utils import _dtmldir
-
class PropertiesTool(UniqueObject, SimpleItem, ActionProviderBase):
implements(IPropertiesTool)
@@ -51,7 +50,7 @@
# ZMI methods
#
security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainPropertiesTool', _dtmldir )
+ manage_overview = DTMLResource( 'dtml/explainPropertiesTool', globals() )
#
# 'portal_properties' interface methods
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/SyndicationTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/SyndicationTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/SyndicationTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -20,7 +20,6 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from DateTime import DateTime
-from Globals import HTMLFile
from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
@@ -28,12 +27,12 @@
from Products.CMFCore.PortalFolder import PortalFolderBase
from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.utils import UniqueObject
+from Products.CMFCore.utils import DTMLResource
from exceptions import AccessControl_Unauthorized
from permissions import ManagePortal
from permissions import ManageProperties
from SyndicationInfo import SyndicationInformation
-from utils import _dtmldir
class SyndicationTool(UniqueObject, SimpleItem, ActionProviderBase):
@@ -83,16 +82,16 @@
)
security.declareProtected(ManagePortal, 'overview')
- overview = HTMLFile('synOverview', _dtmldir)
+ overview = DTMLResource('dtml/synOverview', globals())
security.declareProtected(ManagePortal, 'propertiesForm')
- propertiesForm = HTMLFile('synProps', _dtmldir)
+ propertiesForm = DTMLResource('dtml/synProps', globals())
security.declareProtected(ManagePortal, 'policiesForm')
- policiesForm = HTMLFile('synPolicies', _dtmldir)
+ policiesForm = DTMLResource('dtml/synPolicies', globals())
security.declareProtected(ManagePortal, 'reportForm')
- reportForm = HTMLFile('synReports', _dtmldir)
+ reportForm = DTMLResource('dtml/synReports', globals())
security.declareProtected(ManagePortal, 'editProperties')
def editProperties( self
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/factory.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/factory.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/factory.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -15,23 +15,21 @@
$Id$
"""
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-
from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import PageTemplateResource
from Products.GenericSetup import EXTENSION
from Products.GenericSetup import profile_registry
from Products.GenericSetup.tool import SetupTool
from Portal import CMFSite
-from utils import _wwwdir
_TOOL_ID = 'portal_setup'
-
def addConfiguredSiteForm(dispatcher):
""" Wrap the PTF in 'dispatcher', including 'profile_registry' in options.
"""
- wrapped = PageTemplateFile( 'siteAddForm', _wwwdir ).__of__( dispatcher )
+ wrapped = PageTemplateResource( 'www/siteAddForm', globals()
+ ).__of__( dispatcher )
base_profiles = []
extension_profiles = []
Modified: CMF/branches/tseaver-pkg_resources/CMFDefault/utils.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFDefault/utils.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFDefault/utils.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -23,19 +23,13 @@
from sgmllib import SGMLParser
from AccessControl import ModuleSecurityInfo
-from Globals import package_home
from zope.i18nmessageid import MessageIDFactory
from ZTUtils.Zope import complex_marshal
from exceptions import IllegalHTML
-
security = ModuleSecurityInfo( 'Products.CMFDefault.utils' )
-security.declarePrivate('_dtmldir')
-_dtmldir = os.path.join( package_home( globals() ), 'dtml' )
-_wwwdir = os.path.join( package_home( globals() ), 'www' )
-
security.declarePublic('formatRFC822Headers')
def formatRFC822Headers( headers ):
Modified: CMF/branches/tseaver-pkg_resources/CMFSetup/cachingpolicymgr.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFSetup/cachingpolicymgr.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFSetup/cachingpolicymgr.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,9 +18,9 @@
from AccessControl import ClassSecurityInfo
from AccessControl.Permission import Permission
from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import PageTemplateResource
from permissions import ManagePortal
from utils import CONVERTER
@@ -28,7 +28,6 @@
from utils import ExportConfiguratorBase
from utils import ImportConfiguratorBase
from utils import KEY
-from utils import _xmldir
#
# Configurator entry points
@@ -110,7 +109,7 @@
security.declarePrivate('_getExportTemplate')
def _getExportTemplate(self):
- return PageTemplateFile('cpmExport.xml', _xmldir)
+ return PageTemplateResource('xml/cpmExport.xml', globals())
InitializeClass(CachingPolicyManagerExportConfigurator)
Modified: CMF/branches/tseaver-pkg_resources/CMFSetup/contenttyperegistry.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFSetup/contenttyperegistry.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFSetup/contenttyperegistry.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,9 +18,9 @@
from AccessControl import ClassSecurityInfo
from AccessControl.Permission import Permission
from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import PageTemplateResource
from permissions import ManagePortal
from utils import CONVERTER
@@ -28,7 +28,6 @@
from utils import ExportConfiguratorBase
from utils import ImportConfiguratorBase
from utils import KEY
-from utils import _xmldir
#
# Configurator entry points
@@ -111,7 +110,7 @@
security.declarePrivate('_getExportTemplate')
def _getExportTemplate(self):
- return PageTemplateFile('ctrExport.xml', _xmldir)
+ return PageTemplateResource('xml/ctrExport.xml', globals())
InitializeClass(ContentTypeRegistryExportConfigurator)
Modified: CMF/branches/tseaver-pkg_resources/CMFSetup/properties.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFSetup/properties.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFSetup/properties.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -17,12 +17,12 @@
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from Products.CMFCore.utils import PageTemplateResource
from permissions import ManagePortal
-from utils import _xmldir
from utils import ConfiguratorBase
-from utils import DEFAULT, KEY
+from utils import DEFAULT
+from utils import KEY
#
@@ -88,7 +88,7 @@
def _getExportTemplate(self):
- return PageTemplateFile('spcExport.xml', _xmldir)
+ return PageTemplateResource('xml/spcExport.xml', globals())
def _getImportMapping(self):
Modified: CMF/branches/tseaver-pkg_resources/CMFSetup/skins.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFSetup/skins.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFSetup/skins.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -21,17 +21,18 @@
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import minimalpath
+from Products.CMFCore.utils import PageTemplateResource
from Products.CMFCore.DirectoryView import createDirectoryView
from Products.CMFCore.DirectoryView import DirectoryView
from permissions import ManagePortal
-from utils import _xmldir
from utils import ConfiguratorBase
-from utils import CONVERTER, DEFAULT, KEY
+from utils import CONVERTER
+from utils import DEFAULT
+from utils import KEY
#
@@ -263,7 +264,7 @@
def _getExportTemplate(self):
- return PageTemplateFile('stcExport.xml', _xmldir)
+ return PageTemplateResource('xml/stcExport.xml', globals())
def _getImportMapping(self):
Modified: CMF/branches/tseaver-pkg_resources/CMFSetup/typeinfo.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFSetup/typeinfo.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFSetup/typeinfo.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -20,18 +20,20 @@
import Products
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import PageTemplateResource
from Products.GenericSetup.interfaces import INodeExporter
from Products.GenericSetup.interfaces import INodeImporter
-from Products.GenericSetup.interfaces import PURGE, UPDATE
+from Products.GenericSetup.interfaces import PURGE
+from Products.GenericSetup.interfaces import UPDATE
from Products.GenericSetup.utils import PrettyDocument
from permissions import ManagePortal
-from utils import _xmldir
from utils import ImportConfiguratorBase, ExportConfiguratorBase
-from utils import CONVERTER, DEFAULT, KEY
+from utils import CONVERTER
+from utils import DEFAULT
+from utils import KEY
_FILENAME = 'typestool.xml'
@@ -184,7 +186,7 @@
def _getExportTemplate(self):
- return PageTemplateFile('ticToolExport.xml', _xmldir)
+ return PageTemplateResource('xml/ticToolExport.xml', globals())
InitializeClass(TypesToolExportConfigurator)
Modified: CMF/branches/tseaver-pkg_resources/CMFSetup/utils.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFSetup/utils.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFSetup/utils.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -23,16 +23,12 @@
from Acquisition import aq_base
from Acquisition import Implicit
from Globals import InitializeClass
-from Globals import package_home
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from Products.CMFCore.utils import PageTemplateResource
from exceptions import BadRequest
from permissions import ManagePortal
-_pkgdir = package_home( globals() )
-_xmldir = os.path.join( _pkgdir, 'xml' )
-
CONVERTER, DEFAULT, KEY = range(3)
@@ -243,8 +239,8 @@
#
# generic object and property support
#
- _ob_nodes = PageTemplateFile('object_nodes.xml', _xmldir)
- _prop_nodes = PageTemplateFile('property_nodes.xml', _xmldir)
+ _ob_nodes = PageTemplateResource('xml/object_nodes.xml', globals())
+ _prop_nodes = PageTemplateResource('xml/property_nodes.xml', globals())
security.declareProtected(ManagePortal, 'generateObjectNodes')
def generateObjectNodes(self, obj_infos):
Modified: CMF/branches/tseaver-pkg_resources/CMFSetup/workflow.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFSetup/workflow.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFSetup/workflow.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -21,9 +21,9 @@
from AccessControl import ClassSecurityInfo
from Acquisition import Implicit
from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import PageTemplateResource
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from permissions import ManagePortal
@@ -32,7 +32,6 @@
from utils import _getNodeAttribute
from utils import _getNodeAttributeBoolean
from utils import _queryNodeAttribute
-from utils import _xmldir
from utils import ConfiguratorBase
from utils import CONVERTER, DEFAULT, KEY
@@ -264,7 +263,7 @@
def _getExportTemplate(self):
- return PageTemplateFile('wtcToolExport.xml', _xmldir)
+ return PageTemplateResource('xml/wtcToolExport.xml', globals())
def _getImportMapping(self):
@@ -411,10 +410,10 @@
)
security.declarePrivate( '_workflowConfig' )
- _workflowConfig = PageTemplateFile( 'wtcWorkflowExport.xml'
- , _xmldir
- , __name__='workflowConfig'
- )
+ _workflowConfig = PageTemplateResource( 'xml/wtcWorkflowExport.xml'
+ , globals()
+ , __name__='workflowConfig'
+ )
security.declarePrivate( '_extractDCWorkflowInfo' )
def _extractDCWorkflowInfo( self, workflow, workflow_info ):
Modified: CMF/branches/tseaver-pkg_resources/CMFUid/UniqueIdHandlerTool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/CMFUid/UniqueIdHandlerTool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/CMFUid/UniqueIdHandlerTool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -24,14 +24,13 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from Globals import InitializeClass
-from Globals import package_home
from OFS.SimpleItem import SimpleItem
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zope.interface import implements
from Products.CMFCore.ActionProviderBase import ActionProviderBase
from Products.CMFCore.permissions import ManagePortal
from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import PageTemplateResource
from Products.CMFCore.utils import UniqueObject
from Products.CMFUid.interfaces import IUniqueIdBrainQuery
@@ -41,9 +40,6 @@
UID_ATTRIBUTE_NAME = 'cmf_uid'
-_wwwdir = os.path.join( package_home( globals() ), 'www' )
-
-
class UniqueIdHandlerTool(UniqueObject, SimpleItem, ActionProviderBase):
__doc__ = __doc__ # copy from module
@@ -258,6 +254,6 @@
return default
security.declareProtected(ManagePortal, 'manage_queryObject')
- manage_queryObject = PageTemplateFile('queryUID.pt', _wwwdir)
+ manage_queryObject = PageTemplateResource('www/queryUID.pt', globals())
InitializeClass(UniqueIdHandlerTool)
Modified: CMF/branches/tseaver-pkg_resources/DCWorkflow/Guard.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/DCWorkflow/Guard.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/DCWorkflow/Guard.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -17,20 +17,19 @@
from cgi import escape
-from Globals import DTMLFile
from Globals import InitializeClass
from Globals import Persistent
from AccessControl import ClassSecurityInfo
from Acquisition import Explicit
from Acquisition import aq_base
+from Products.CMFCore.utils import DTMLResource
from Products.CMFCore.utils import _checkPermission
from Expression import Expression
from Expression import StateChangeInfo
from Expression import createExprContext
from permissions import ManagePortal
-from utils import _dtmldir
class Guard (Persistent, Explicit):
@@ -42,7 +41,7 @@
security = ClassSecurityInfo()
security.declareObjectProtected(ManagePortal)
- guardForm = DTMLFile('guard', _dtmldir)
+ guardForm = DTMLResource('dtml/guard', globals())
def check(self, sm, wf_def, ob, **kw):
"""Checks conditions in this guard.
Modified: CMF/branches/tseaver-pkg_resources/DCWorkflow/States.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/DCWorkflow/States.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/DCWorkflow/States.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,15 +18,14 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_inner
from Acquisition import aq_parent
-from Globals import DTMLFile
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.SimpleItem import SimpleItem
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from Products.CMFCore.utils import DTMLResource
+from Products.CMFCore.utils import PageTemplateResource
from ContainerTab import ContainerTab
from permissions import ManagePortal
-from utils import _dtmldir
class StateDefinition(SimpleItem):
@@ -104,7 +103,7 @@
return self.group_roles.get(group, ())
return ()
- _properties_form = DTMLFile('state_properties', _dtmldir)
+ _properties_form = DTMLResource('dtml/state_properties', globals())
def manage_properties(self, REQUEST, manage_tabs_message=None):
"""Show state properties ZMI form."""
@@ -122,7 +121,7 @@
return self.manage_properties(REQUEST, 'Properties changed.')
- _variables_form = DTMLFile('state_variables', _dtmldir)
+ _variables_form = DTMLResource('dtml/state_variables', globals())
def manage_variables(self, REQUEST, manage_tabs_message=None):
"""Show State variables ZMI form."""
@@ -187,7 +186,7 @@
- _permissions_form = DTMLFile('state_permissions', _dtmldir)
+ _permissions_form = DTMLResource('dtml/state_permissions', globals())
def manage_permissions(self, REQUEST, manage_tabs_message=None):
"""Present TTW UI for managing this State's permissions."""
@@ -225,7 +224,7 @@
roles = tuple(roles)
pr[permission] = roles
- manage_groups = PageTemplateFile('state_groups.pt', _dtmldir)
+ manage_groups = PageTemplateResource('dtml/state_groups.pt', globals())
def setGroups(self, REQUEST, RESPONSE=None):
"""Set the group to role mappings in REQUEST for this State.
@@ -263,7 +262,7 @@
'action':'addState',
},)
- _manage_states = DTMLFile('states', _dtmldir)
+ _manage_states = DTMLResource('dtml/states', globals())
def manage_main(self, REQUEST, manage_tabs_message=None):
'''
Modified: CMF/branches/tseaver-pkg_resources/DCWorkflow/Transitions.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/DCWorkflow/Transitions.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/DCWorkflow/Transitions.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,17 +16,16 @@
"""
from OFS.SimpleItem import SimpleItem
-from Globals import DTMLFile
from Globals import PersistentMapping
from Globals import InitializeClass
from Acquisition import aq_inner
from Acquisition import aq_parent
from AccessControl import ClassSecurityInfo
+from Products.CMFCore.utils import DTMLResource
from ContainerTab import ContainerTab
from Guard import Guard
from permissions import ManagePortal
-from utils import _dtmldir
from Expression import Expression
TRIGGER_AUTOMATIC = 0
@@ -98,7 +97,8 @@
def getAvailableVarIds(self):
return self.getWorkflow().variables.keys()
- _properties_form = DTMLFile('transition_properties', _dtmldir)
+ _properties_form = DTMLResource('dtml/transition_properties',
+ globals())
def manage_properties(self, REQUEST, manage_tabs_message=None):
'''
@@ -133,7 +133,7 @@
if REQUEST is not None:
return self.manage_properties(REQUEST, 'Properties changed.')
- _variables_form = DTMLFile('transition_variables', _dtmldir)
+ _variables_form = DTMLResource('dtml/transition_variables', globals())
def manage_variables(self, REQUEST, manage_tabs_message=None):
'''
@@ -229,7 +229,7 @@
'action':'addTransition',
},)
- _manage_transitions = DTMLFile('transitions', _dtmldir)
+ _manage_transitions = DTMLResource('dtml/transitions', globals())
def manage_main(self, REQUEST, manage_tabs_message=None):
'''
Modified: CMF/branches/tseaver-pkg_resources/DCWorkflow/Variables.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/DCWorkflow/Variables.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/DCWorkflow/Variables.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,17 +18,15 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_inner
from Acquisition import aq_parent
-from Globals import DTMLFile
from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
+from Products.CMFCore.utils import DTMLResource
from ContainerTab import ContainerTab
from Expression import Expression
from Guard import Guard
from permissions import ManagePortal
-from utils import _dtmldir
-
class VariableDefinition(SimpleItem):
"""Variable definition"""
@@ -70,7 +68,7 @@
res = self.info_guard.getSummary()
return res
- _properties_form = DTMLFile('variable_properties', _dtmldir)
+ _properties_form = DTMLResource('dtml/variable_properties', globals())
def manage_properties(self, REQUEST, manage_tabs_message=None):
'''
@@ -117,7 +115,7 @@
'action':'addVariable',
},)
- _manage_variables = DTMLFile('variables', _dtmldir)
+ _manage_variables = DTMLResource('dtml/variables', globals())
def manage_main(self, REQUEST, manage_tabs_message=None):
'''
Modified: CMF/branches/tseaver-pkg_resources/DCWorkflow/WorkflowUIMixin.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/DCWorkflow/WorkflowUIMixin.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/DCWorkflow/WorkflowUIMixin.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -17,16 +17,15 @@
import os
-from Globals import DTMLFile
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Acquisition import aq_get
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from Products.CMFCore.utils import DTMLResource
+from Products.CMFCore.utils import PageTemplateResource
from permissions import ManagePortal
from Guard import Guard
-from utils import _dtmldir
try:
#
@@ -49,8 +48,8 @@
security = ClassSecurityInfo()
security.declareProtected(ManagePortal, 'manage_properties')
- manage_properties = DTMLFile('workflow_properties', _dtmldir)
- manage_groups = PageTemplateFile('workflow_groups.pt', _dtmldir)
+ manage_properties = DTMLResource('dtml/workflow_properties', globals())
+ manage_groups = PageTemplateResource('dtml/workflow_groups.pt', globals())
security.declareProtected(ManagePortal, 'setProperties')
def setProperties(self, title, manager_bypass=0, props=None, REQUEST=None):
@@ -67,7 +66,7 @@
return self.manage_properties(
REQUEST, manage_tabs_message='Properties changed.')
- _permissions_form = DTMLFile('workflow_permissions', _dtmldir)
+ _permissions_form = DTMLResource('dtml/workflow_permissions', globals())
security.declareProtected(ManagePortal, 'manage_permissions')
def manage_permissions(self, REQUEST, manage_tabs_message=None):
Modified: CMF/branches/tseaver-pkg_resources/DCWorkflow/Worklists.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/DCWorkflow/Worklists.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/DCWorkflow/Worklists.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,15 +18,14 @@
from AccessControl import ClassSecurityInfo
from Acquisition import aq_inner
from Acquisition import aq_parent
-from Globals import DTMLFile
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.SimpleItem import SimpleItem
+from Products.CMFCore.utils import DTMLResource
from ContainerTab import ContainerTab
from Guard import Guard
from permissions import ManagePortal
-from utils import _dtmldir
class WorklistDefinition(SimpleItem):
@@ -96,7 +95,7 @@
values = self.getVarMatch(id)
return '; '.join(values)
- _properties_form = DTMLFile('worklist_properties', _dtmldir)
+ _properties_form = DTMLResource('dtml/worklist_properties', globals())
def manage_properties(self, REQUEST, manage_tabs_message=None):
'''
@@ -152,7 +151,7 @@
'action':'addWorklist',
},)
- _manage_worklists = DTMLFile('worklists', _dtmldir)
+ _manage_worklists = DTMLResource('dtml/worklists', globals())
def manage_main(self, REQUEST, manage_tabs_message=None):
'''
Modified: CMF/branches/tseaver-pkg_resources/DCWorkflow/utils.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/DCWorkflow/utils.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/DCWorkflow/utils.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -16,10 +16,7 @@
"""
import os
-from App.Common import package_home
-_dtmldir = os.path.join( package_home( globals() ), 'dtml' )
-
from AccessControl.Role import gather_permissions
from AccessControl.Permission import Permission
from Acquisition import aq_base
Modified: CMF/branches/tseaver-pkg_resources/GenericSetup/registry.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/GenericSetup/registry.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/GenericSetup/registry.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -20,7 +20,6 @@
from AccessControl import ClassSecurityInfo
from Acquisition import Implicit
from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zope.interface import implements
from interfaces import BASE
@@ -29,11 +28,11 @@
from interfaces import IToolsetRegistry
from interfaces import IProfileRegistry
from permissions import ManagePortal
-from utils import HandlerBase
-from utils import _xmldir
from utils import _getDottedName
from utils import _resolveDottedName
from utils import _extractDocstring
+from utils import HandlerBase
+from utils import PageTemplateResource
class ImportStepRegistry( Implicit ):
@@ -251,7 +250,7 @@
return result
security.declarePrivate( '_exportTemplate' )
- _exportTemplate = PageTemplateFile( 'isrExport.xml', _xmldir )
+ _exportTemplate = PageTemplateResource( 'xml/isrExport.xml', globals() )
InitializeClass( ImportStepRegistry )
@@ -396,7 +395,7 @@
# Helper methods
#
security.declarePrivate( '_exportTemplate' )
- _exportTemplate = PageTemplateFile( 'esrExport.xml', _xmldir )
+ _exportTemplate = PageTemplateResource( 'xml/esrExport.xml', globals() )
InitializeClass( ExportStepRegistry )
@@ -510,10 +509,10 @@
# Helper methods.
#
security.declarePrivate( '_toolsetConfig' )
- _toolsetConfig = PageTemplateFile( 'tscExport.xml'
- , _xmldir
- , __name__='toolsetConfig'
- )
+ _toolsetConfig = PageTemplateResource( 'xml/tscExport.xml'
+ , globals()
+ , __name__='toolsetConfig'
+ )
InitializeClass( ToolsetRegistry )
Modified: CMF/branches/tseaver-pkg_resources/GenericSetup/rolemap.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/GenericSetup/rolemap.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/GenericSetup/rolemap.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -18,12 +18,13 @@
from AccessControl import ClassSecurityInfo
from AccessControl.Permission import Permission
from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from permissions import ManagePortal
-from utils import _xmldir
from utils import ConfiguratorBase
-from utils import CONVERTER, DEFAULT, KEY
+from utils import CONVERTER
+from utils import DEFAULT
+from utils import KEY
+from utils import PageTemplateResource
#
@@ -190,7 +191,7 @@
def _getExportTemplate(self):
- return PageTemplateFile('rmeExport.xml', _xmldir)
+ return PageTemplateResource('xml/rmeExport.xml', globals())
def _getImportMapping(self):
Modified: CMF/branches/tseaver-pkg_resources/GenericSetup/tool.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/GenericSetup/tool.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/GenericSetup/tool.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -23,7 +23,6 @@
from Acquisition import aq_base
from Globals import InitializeClass
from OFS.Folder import Folder
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zope.interface import implements
from zope.interface import implementedBy
@@ -39,9 +38,8 @@
from registry import ExportStepRegistry
from registry import ToolsetRegistry
from registry import _profile_registry
-
from utils import _resolveDottedName
-from utils import _wwwdir
+from utils import PageTemplateResource
IMPORT_STEPS_XML = 'import_steps.xml'
EXPORT_STEPS_XML = 'export_steps.xml'
@@ -370,7 +368,7 @@
)
security.declareProtected(ManagePortal, 'manage_tool')
- manage_tool = PageTemplateFile('sutProperties', _wwwdir)
+ manage_tool = PageTemplateResource('www/sutProperties', globals())
security.declareProtected(ManagePortal, 'manage_updateToolProperties')
def manage_updateToolProperties(self, context_id, RESPONSE):
@@ -382,7 +380,7 @@
% (self.absolute_url(), 'Properties+updated.'))
security.declareProtected(ManagePortal, 'manage_importSteps')
- manage_importSteps = PageTemplateFile('sutImportSteps', _wwwdir)
+ manage_importSteps = PageTemplateResource('www/sutImportSteps', globals())
security.declareProtected(ManagePortal, 'manage_importSelectedSteps')
def manage_importSelectedSteps(self,
@@ -418,7 +416,7 @@
% (self.absolute_url(), message))
security.declareProtected(ManagePortal, 'manage_exportSteps')
- manage_exportSteps = PageTemplateFile('sutExportSteps', _wwwdir)
+ manage_exportSteps = PageTemplateResource('www/sutExportSteps', globals())
security.declareProtected(ManagePortal, 'manage_exportSelectedSteps')
def manage_exportSelectedSteps(self, ids, RESPONSE):
@@ -447,7 +445,7 @@
return result['tarball']
security.declareProtected(ManagePortal, 'manage_snapshots')
- manage_snapshots = PageTemplateFile('sutSnapshots', _wwwdir)
+ manage_snapshots = PageTemplateResource('www/sutSnapshots', globals())
security.declareProtected(ManagePortal, 'listSnapshotInfo')
def listSnapshotInfo(self):
@@ -526,7 +524,7 @@
% (self.absolute_url(), 'Snapshot+created.'))
security.declareProtected(ManagePortal, 'manage_showDiff')
- manage_showDiff = PageTemplateFile('sutCompare', _wwwdir)
+ manage_showDiff = PageTemplateResource('www/sutCompare', globals())
def manage_downloadDiff(self,
lhs,
@@ -722,7 +720,7 @@
_TOOL_ID = 'setup_tool'
-addSetupToolForm = PageTemplateFile('toolAdd.zpt', _wwwdir)
+addSetupToolForm = PageTemplateResource('www/toolAdd.zpt', globals())
def addSetupTool(dispatcher, RESPONSE):
"""
Modified: CMF/branches/tseaver-pkg_resources/GenericSetup/utils.py
===================================================================
--- CMF/branches/tseaver-pkg_resources/GenericSetup/utils.py 2005-11-10 17:46:43 UTC (rev 40032)
+++ CMF/branches/tseaver-pkg_resources/GenericSetup/utils.py 2005-11-10 17:56:53 UTC (rev 40033)
@@ -28,10 +28,21 @@
from AccessControl import ClassSecurityInfo
from Acquisition import Implicit
from Globals import InitializeClass
-from Globals import package_home
from TAL.TALDefs import attrEscape
from zope.interface import implements
+try:
+ import Products.Basket
+except ImportError: # no egg support :-<
+ from Globals import ImageFile as ImageResource
+ from Globals import DTMLFile as DTMLResource
+ from Products.PageTemplates.PageTemplateFile \
+ import PageTemplateFile as PageTemplateResource
+else:
+ from Globals import ImageResource
+ from Globals import DTMLResource
+ from Products.PageTemplates import PageTemplateResource
+
from exceptions import BadRequest
from interfaces import INodeExporter
from interfaces import INodeImporter
@@ -39,10 +50,6 @@
from permissions import ManagePortal
-_pkgdir = package_home( globals() )
-_wwwdir = os.path.join( _pkgdir, 'www' )
-_xmldir = os.path.join( _pkgdir, 'xml' )
-
CONVERTER, DEFAULT, KEY = range(3)
I18NURI = 'http://xml.zope.org/namespaces/i18n'
More information about the CMF-checkins
mailing list