[CMF-checkins] CVS: CMF/CMFDefault - DiscussionTool.py:1.19 MetadataTool.py:1.22 SyndicationTool.py:1.24 exceptions.py:1.3

Yvo Schubbe y.2004_ at wcm-solutions.de
Wed May 5 10:18:55 EDT 2004


Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv24494/CMFDefault

Modified Files:
	DiscussionTool.py MetadataTool.py SyndicationTool.py 
	exceptions.py 
Log Message:
- moved CMFDefault exceptions from CMFCore to CMFDefault
- moved some exceptions to the related exceptions.py
- replaced some string exceptions by zExceptions exceptions
- whitespace cleanup
- import cleanup


=== CMF/CMFDefault/DiscussionTool.py 1.18 => 1.19 ===
--- CMF/CMFDefault/DiscussionTool.py:1.18	Thu Apr 29 12:13:17 2004
+++ CMF/CMFDefault/DiscussionTool.py	Wed May  5 10:18:24 2004
@@ -15,9 +15,9 @@
 $Id$
 """
 
-from Globals import InitializeClass
-from Globals import DTMLFile
 from AccessControl import ClassSecurityInfo
+from Globals import DTMLFile
+from Globals import InitializeClass
 from OFS.SimpleItem import SimpleItem
 
 from Products.CMFCore.ActionInformation import ActionInformation
@@ -29,16 +29,14 @@
 from Products.CMFCore.utils import UniqueObject
 
 from DiscussionItem import DiscussionItemContainer
-from utils import _dtmldir
 from exceptions import AccessControl_Unauthorized
+from exceptions import DiscussionNotAllowed
 from permissions import ManagePortal
 from permissions import ModifyPortalContent
 from permissions import ReplyToItem
+from utils import _dtmldir
 
 
-class DiscussionNotAllowed( Exception ):
-    pass
-
 class DiscussionTool( UniqueObject, SimpleItem, ActionProviderBase ):
 
     __implements__ = (IDiscussionTool, ActionProviderBase.__implements__)
@@ -63,7 +61,7 @@
 
     manage_options = (ActionProviderBase.manage_options +
                      ({ 'label' : 'Overview', 'action' : 'manage_overview' }
-                     , 
+                     ,
                      ) + SimpleItem.manage_options)
 
     #
@@ -99,11 +97,11 @@
         """
         if not self.isDiscussionAllowedFor( content ):
             raise DiscussionNotAllowed
-            
+
         talkback = getattr( content, 'talkback', None )
         if not talkback:
             talkback = self._createDiscussionFor( content )
-        
+
         return talkback
 
     security.declarePublic( 'isDiscussionAllowedFor' )


=== CMF/CMFDefault/MetadataTool.py 1.21 => 1.22 ===
--- CMF/CMFDefault/MetadataTool.py:1.21	Thu Apr 29 12:13:17 2004
+++ CMF/CMFDefault/MetadataTool.py	Wed May  5 10:18:24 2004
@@ -15,24 +15,25 @@
 $Id$
 """
 
-from OFS.SimpleItem import SimpleItem
-from Globals import PersistentMapping
-
-from Globals import InitializeClass
-from Globals import DTMLFile
 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
 
-from Products.CMFCore.utils import UniqueObject
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
 from Products.CMFCore.interfaces.portal_metadata \
         import portal_metadata as IMetadataTool
+from Products.CMFCore.utils import UniqueObject
 
-from permissions import View
+from exceptions import MetadataError
 from permissions import ManagePortal
 from permissions import ModifyPortalContent
+from permissions import View
 from utils import _dtmldir
 
+
 class MetadataElementPolicy( SimpleItem ):
     """
         Represent a type-specific policy about a particular DCMI element.
@@ -84,7 +85,7 @@
             Must this element be supplied?
         """
         return self.is_required
-    
+
     security.declareProtected(View , 'supplyDefault')
     def supplyDefault( self ):
         """
@@ -122,6 +123,7 @@
                         , ( 'Rights', 0 )
                         )
 
+
 class ElementSpec( SimpleItem ):
     """
         Represent all the tool knows about a single metadata element.
@@ -137,8 +139,7 @@
         self.is_multi_valued  = is_multi_valued
         self.policies         = PersistentMapping()
         self.policies[ None ] = self._makePolicy()  # set default policy
-        
-    
+
     security.declarePrivate( '_makePolicy' )
     def _makePolicy( self ):
         return MetadataElementPolicy( self.is_multi_valued )
@@ -197,8 +198,6 @@
 
 InitializeClass( ElementSpec )
 
-class MetadataError( Exception ):
-    pass
 
 class MetadataTool( UniqueObject, SimpleItem, ActionProviderBase ):
 
@@ -238,7 +237,7 @@
     #
     #   ZMI methods
     #
-    manage_options = ( ActionProviderBase.manage_options + 
+    manage_options = ( ActionProviderBase.manage_options +
                      ( { 'label'      : 'Overview'
                          , 'action'     : 'manage_overview'
                          }


=== CMF/CMFDefault/SyndicationTool.py 1.23 => 1.24 ===
--- CMF/CMFDefault/SyndicationTool.py:1.23	Thu Apr 29 12:13:18 2004
+++ CMF/CMFDefault/SyndicationTool.py	Wed May  5 10:18:24 2004
@@ -18,7 +18,6 @@
 """
 
 from AccessControl import ClassSecurityInfo
-from AccessControl import Unauthorized
 from Acquisition import aq_base
 from DateTime import DateTime
 from Globals import HTMLFile
@@ -32,10 +31,11 @@
 from Products.CMFCore.utils import _checkPermission
 from Products.CMFCore.utils import UniqueObject
 
-from SyndicationInfo import SyndicationInformation
+from exceptions import AccessControl_Unauthorized
 from permissions import AccessContentsInformation
 from permissions import ManagePortal
 from permissions import ManageProperties
+from SyndicationInfo import SyndicationInformation
 from utils import _dtmldir
 
 
@@ -180,7 +180,7 @@
         Not Sitewide Properties.
         """
         if not _checkPermission( ManageProperties, obj ):
-            raise Unauthorized
+            raise AccessControl_Unauthorized
 
         syInfo = getattr(obj, 'syndication_information', None)
 


=== CMF/CMFDefault/exceptions.py 1.2 => 1.3 ===
--- CMF/CMFDefault/exceptions.py:1.2	Thu Apr 29 12:13:18 2004
+++ CMF/CMFDefault/exceptions.py	Wed May  5 10:18:24 2004
@@ -1,7 +1,20 @@
-""" CMFDefault product exceptions
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+""" CMFDefault product exceptions.
 
 $Id$
 """
+
 from AccessControl import ModuleSecurityInfo
 security = ModuleSecurityInfo('Products.CMFDefault.exceptions')
 
@@ -11,14 +24,32 @@
 security.declarePublic('CopyError')
 from Products.CMFCore.exceptions import CopyError
 
-security.declarePublic('EditingConflict')
-from Products.CMFCore.exceptions import EditingConflict
-
-security.declarePublic('IllegalHTML')
-from Products.CMFCore.exceptions import IllegalHTML
-
 security.declarePublic('ResourceLockedError')
 from Products.CMFCore.exceptions import ResourceLockedError
 
 security.declarePublic('zExceptions_Unauthorized')
 from Products.CMFCore.exceptions import zExceptions_Unauthorized
+
+
+security.declarePublic('EditingConflict')
+class EditingConflict(Exception):
+    """ Editing conflict error.
+    """
+
+
+security.declarePublic('DiscussionNotAllowed')
+class DiscussionNotAllowed(Exception):
+    """ Discussion not allowed error.
+    """
+
+
+security.declarePublic('IllegalHTML')
+class IllegalHTML(ValueError):
+    """ Illegal HTML error.
+    """
+
+
+security.declarePublic('MetadataError')
+class MetadataError(Exception):
+    """ Metadata error.
+    """




More information about the CMF-checkins mailing list