[CMF-checkins] CVS: CMF/CMFCore - FSMetadata.py:1.4.4.1 PortalContent.py:1.42.10.1

Sidnei da Silva sidnei@x3ng.com.br
Sat, 24 May 2003 10:40:32 -0400


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

Modified Files:
      Tag: CMF-1_4-branch
	FSMetadata.py PortalContent.py 
Log Message:
Whitespace cleaning, plus report the filename upon exception

=== CMF/CMFCore/FSMetadata.py 1.4 => 1.4.4.1 ===
--- CMF/CMFCore/FSMetadata.py:1.4	Mon Mar 24 00:12:27 2003
+++ CMF/CMFCore/FSMetadata.py	Sat May 24 10:40:31 2003
@@ -11,7 +11,7 @@
 import re
 
 class CMFConfigParser(ConfigParser):
-    """ This our wrapper around ConfigParser to 
+    """ This our wrapper around ConfigParser to
     solve a few minor niggles with the code """
     # adding in a space so that names can contain spaces
     OPTCRE = re.compile(
@@ -21,11 +21,11 @@
                                               # (either : or =), followed
                                               # by any # space/tab
         r'(?P<value>.*)$'                     # everything up to eol
-        )    
+        )
 
     def optionxform(self, optionstr):
-        """ 
-        Stop converting the key to lower case, very annoying for security etc 
+        """
+        Stop converting the key to lower case, very annoying for security etc
         """
         return optionstr.strip()
 
@@ -35,8 +35,8 @@
         self._filename = filename
 
     def read(self):
-        """ Find the files to read, either the old security and properties type or
-        the new metadata type """
+        """ Find the files to read, either the old
+        security and properties type or the new metadata type """
         filename = self._filename + '.metadata'
         if exists(filename):
             # found the new type, lets use that
@@ -70,45 +70,47 @@
 
         # the two sections we care about
         self._properties = self._getSectionDict(cfg, 'default')
-        self._security = self._getSectionDict(cfg, 'security', self._securityParser)
+        self._security = self._getSectionDict(cfg, 'security',
+                                              self._securityParser)
         # to add in a new value such as proxy roles,
         # just add in the section, call it using getSectionDict
         # if you need a special parser for some whacky
         # config, then just pass through a special parser
-    
+
     def _nullParser(self, data):
-        """ 
-        This is the standard rather boring null parser that does very little 
+        """
+        This is the standard rather boring null parser that does very little
         """
         return data
-    
+
     def _securityParser(self, data):
-        """ A specific parser for security lines 
-        
+        """ A specific parser for security lines
+
         Security lines must be of the format
-        
+
         (0|1):Role[,Role...]
-        
+
         Where 0|1 is the acquire permission setting
         and Role is the roles for this permission
         eg: 1:Manager or 0:Manager,Anonymous
         """
-        if data.find(':') < 1: 
-            raise ValueError, "The security declaration is in the wrong format"
-            
+        if data.find(':') < 1:
+            raise ValueError, "The security declaration of file " + \
+                  "%r is in the wrong format" % self._filename
+
         acquire, roles = data.split(':')
         roles = [r.strip() for r in roles.split(',') if r.strip()]
         return (acquire, roles)
 
     def _getSectionDict(self, cfg, section, parser=None):
-        """ 
+        """
         Get a section and put it into a dict, mostly a convenience
         function around the ConfigParser
-        
+
         Note: the parser is a function to parse each value, so you can
-        have custom values for the key value pairs 
+        have custom values for the key value pairs
         """
-        if parser is None: 
+        if parser is None:
             parser = self._nullParser
 
         props = {}
@@ -124,7 +126,7 @@
     def _old_readProperties(self):
         """
         Reads the properties file next to an object.
-        
+
         Moved from DirectoryView.py to here with only minor
         modifications. Old and deprecated in favour of .metadata now
         """
@@ -148,11 +150,11 @@
                         error=exc_info())
 
             return props
-    
+
     def _old_readSecurity(self):
         """
         Reads the security file next to an object.
-        
+
         Moved from DirectoryView.py to here with only minor
         modifications. Old and deprecated in favour of .metadata now
         """
@@ -160,7 +162,7 @@
         try:
             f = open(fp, 'rt')
         except IOError:
-            return None        
+            return None
         else:
             lines = f.readlines()
             f.close()
@@ -170,7 +172,7 @@
                     c1 = line.index(':')+1
                     c2 = line.index(':',c1)
                     permission = line[:c1-1]
-                    acquire = not not line[c1:c2] # get boolean                    
+                    acquire = not not line[c1:c2] # get boolean
                     proles = line[c2+1:].split(',')
                     roles=[]
                     for role in proles:


=== CMF/CMFCore/PortalContent.py 1.42 => 1.42.10.1 ===
--- CMF/CMFCore/PortalContent.py:1.42	Thu Feb 13 03:31:01 2003
+++ CMF/CMFCore/PortalContent.py	Sat May 24 10:40:31 2003
@@ -35,7 +35,7 @@
     class ResourceLockedError( Exception ):
         pass
 
-try: 
+try:
     from webdav.WriteLockInterface import WriteLockInterface
     NoWL = 0
 except ImportError:
@@ -45,13 +45,13 @@
 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,