[CMF-checkins] CVS: CMF/CMFDefault - URLTool.py:1.13 __init__.py:1.17
Yvo Schubbe
schubbe@web.de
Wed, 11 Dec 2002 17:22:10 -0500
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv7049/CMFDefault
Modified Files:
URLTool.py __init__.py
Log Message:
Merged yuppie-collector067-branch:
- Moved URLTool to CMFCore. (Collector #67)
=== CMF/CMFDefault/URLTool.py 1.12 => 1.13 ===
--- CMF/CMFDefault/URLTool.py:1.12 Sat Aug 3 22:31:31 2002
+++ CMF/CMFDefault/URLTool.py Wed Dec 11 17:21:39 2002
@@ -15,102 +15,5 @@
$Id$
"""
-
-from Products.CMFCore.utils import UniqueObject
-from OFS.SimpleItem import SimpleItem
-import string
-from Acquisition import aq_inner, aq_parent
-
-from Globals import InitializeClass, DTMLFile
-from AccessControl import ClassSecurityInfo
-from Products.CMFCore.ActionProviderBase import ActionProviderBase
-from Products.CMFCore.ActionInformation import ActionInformation
-from Products.CMFCore.Expression import Expression
-from Products.CMFCore.CMFCorePermissions import View
-from Products.CMFCore.CMFCorePermissions import ManagePortal
-from utils import _dtmldir
-
-class URLTool (UniqueObject, SimpleItem, ActionProviderBase):
- id = 'portal_url'
- meta_type = 'Default URL Tool'
- _actions = []
-
- security = ClassSecurityInfo()
- security.declareObjectProtected(View)
-
- manage_options = ( ActionProviderBase.manage_options +
- ({ 'label' : 'Overview', 'action' : 'manage_overview' }
- ,
- ) + SimpleItem.manage_options
- )
-
- #
- # ZMI methods
- #
- security.declareProtected(ManagePortal, 'manage_overview')
- manage_overview = DTMLFile( 'explainURLTool', _dtmldir )
-
- #
- # 'portal_url' interface methods
- #
- security.declarePublic( '__call__' )
- def __call__(self, relative=0, *args, **kw):
- '''
- Returns the absolute URL of the portal.
- '''
- return aq_parent(aq_inner(self)).absolute_url(relative=relative)
-
- security.declarePrivate('listActions')
- def listActions(self, info=None):
- """
- Return a list of actions provided via the tool
- """
- return self._actions
-
- security.declarePublic( 'getPortalObject' )
- def getPortalObject( self ):
- """
- Return the portal object itself.
- """
- return self.aq_inner.aq_parent
-
- security.declarePublic( 'getRelativeContentPath' )
- def getRelativeContentPath( self, content ):
- """
- Return the path (sequence of IDs) for an object, relative
- to the portal root
- """
- portal_path_length = len(self.aq_inner.aq_parent.getPhysicalPath())
- content_location = content.getPhysicalPath()
- return content_location[portal_path_length:]
-
- security.declarePublic( 'getRelativeContentURL' )
- def getRelativeContentURL( self, content ):
- """
- Return the URL (slash-separated string) for an object,
- relative to the portal root
- """
- return string.join( self.getRelativeContentPath( content ), '/' )
-
- security.declarePublic( 'getRelativeUrl' )
- def getRelativeUrl(self, content):
- """
- Returns a URL for an object that is relative
- to the portal root. This is helpful for virtual hosting
- situations.
- """
- portal_path_length = len(self.aq_inner.aq_parent.getPhysicalPath())
- content_location = content.getPhysicalPath()
- rel_path = content_location[portal_path_length:]
-
- return string.join(rel_path, '/')
-
- security.declarePublic( 'getPortalPath' )
- def getPortalPath(self):
- """
- Returns the portal object's URL without the server URL component
- """
- return string.join(self.aq_inner.aq_parent.getPhysicalPath(), '/')
-
-
-InitializeClass(URLTool)
+# for URL Tools created with CMF versions before 1.4
+from Products.CMFCore.URLTool import URLTool
=== CMF/CMFDefault/__init__.py 1.16 => 1.17 ===
--- CMF/CMFDefault/__init__.py:1.16 Thu Nov 21 12:53:29 2002
+++ CMF/CMFDefault/__init__.py Wed Dec 11 17:21:39 2002
@@ -42,7 +42,6 @@
import MembershipTool
import MetadataTool
import RegistrationTool
-import URLTool
import DublinCore
import DiscussionTool
import SyndicationTool
@@ -111,7 +110,6 @@
, MembershipTool.MembershipTool
, RegistrationTool.RegistrationTool
, PropertiesTool.PropertiesTool
- , URLTool.URLTool
, MetadataTool.MetadataTool
, SyndicationTool.SyndicationTool
)