[CMF-checkins] CVS: CMF/CMFCore - CMFCoreExceptions.py:1.3 PortalContent.py:1.44

Yvo Schubbe schubbe at web.de
Thu Sep 25 07:37:19 EDT 2003


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv2764/CMFCore

Modified Files:
	CMFCoreExceptions.py PortalContent.py 
Log Message:
replaced bare excepts in skin scripts and removed NoWL cruft:
- added CMFResourceLockedError and IllegalHTML to CMFCoreExceptions.py
- removed usage of NoWL, updated ResourceLockedError imports
- using CMFCoreExceptions for more specific except statements in scripts
- using urlencode to encode error messages


=== CMF/CMFCore/CMFCoreExceptions.py 1.2 => 1.3 ===
--- CMF/CMFCore/CMFCoreExceptions.py:1.2	Wed Sep 24 06:02:14 2003
+++ CMF/CMFCore/CMFCoreExceptions.py	Thu Sep 25 07:36:48 2003
@@ -17,6 +17,7 @@
 
 from AccessControl import allow_class
 from AccessControl import Unauthorized
+from webdav.Lockable import ResourceLockedError
 
 
 class CMFError(Exception):
@@ -33,8 +34,22 @@
 allow_class(CMFNotImplementedError)
 
 
+class CMFResourceLockedError(ResourceLockedError, CMFError):
+    """ ResourceLockedError in CMF.
+    """
+
+allow_class(CMFResourceLockedError)
+
+
 class CMFUnauthorizedError(Unauthorized, CMFError):
     """ Unauthorized error in CMF.
     """
 
 allow_class(CMFUnauthorizedError)
+
+
+class IllegalHTML(ValueError, CMFError):
+    """ Illegal HTML error.
+    """
+
+allow_class(IllegalHTML)


=== CMF/CMFCore/PortalContent.py 1.43 => 1.44 ===
--- CMF/CMFCore/PortalContent.py:1.43	Mon Apr 28 17:11:13 2003
+++ CMF/CMFCore/PortalContent.py	Thu Sep 25 07:36:48 2003
@@ -15,49 +15,39 @@
 $Id$
 """
 
-from DateTime import DateTime
 from Globals import InitializeClass
 from Acquisition import aq_base
 from OFS.SimpleItem import SimpleItem
 from AccessControl import ClassSecurityInfo
-
-from CMFCorePermissions import AccessContentsInformation, View, FTPAccess
+from webdav.WriteLockInterface import WriteLockInterface
 
 from interfaces.Contentish import Contentish
 from DynamicType import DynamicType
 from utils import _getViewFor
-
 from CMFCatalogAware import CMFCatalogAware
+from CMFCoreExceptions import CMFResourceLockedError
+from CMFCorePermissions import FTPAccess
+from CMFCorePermissions import View
+
 
-try:
-    from webdav.Lockable import ResourceLockedError
-except ImportError:
-    class ResourceLockedError( Exception ):
-        pass
-
-try: 
-    from webdav.WriteLockInterface import WriteLockInterface
-    NoWL = 0
-except ImportError:
-    NoWL = 1
+# Old names that some third-party packages may need.
+NoWL = 0
+from webdav.Lockable import ResourceLockedError
 
 
 class PortalContent(DynamicType, CMFCatalogAware, SimpleItem):
     """
         Base class for portal objects.
-        
+
         Provides hooks for reviewing, indexing, and CMF UI.
 
         Derived classes must implement the interface described in
         interfaces/DublinCore.py.
     """
-    
-    if not NoWL:
-        __implements__ = (WriteLockInterface,
-                          Contentish,
-                          DynamicType.__implements__)
-    else:
-        __implements__ = (Contentish, DynamicType.__implements__)
+
+    __implements__ = (Contentish,
+                      WriteLockInterface,
+                      DynamicType.__implements__)
 
     isPortalContent = 1
     _isPortalContent = 1  # More reliable than 'isPortalContent'.
@@ -91,7 +81,8 @@
         Check if isLocked via webDav
         """
         if self.wl_isLocked():
-            raise ResourceLockedError, 'This resource is locked via webDAV'
+            raise CMFResourceLockedError('This resource is locked via '
+                                         'webDAV.')
         return 0
 
     #




More information about the CMF-checkins mailing list