[Zope-CVS] CVS: Products/FSDump - CHANGES.txt:1.15 Dumper.py:1.15
version.txt:1.10
Tres Seaver
tseaver at palladion.com
Tue May 10 14:11:14 EDT 2005
Update of /cvs-repository/Products/FSDump
In directory cvs.zope.org:/tmp/cvs-serv28224
Modified Files:
CHANGES.txt Dumper.py version.txt
Log Message:
- Applied patch from Sam Brauer, addressing the following issues:
o Proxy roles and security settings weren't being written to
the '.metadata' file.
o The '[Default]' section should be named '[default]'.
o The property-type extensions confuse CMF's FilesystemDirectoryView
(the patch removes the ':string' for string properties; others
are likely still broken).
=== Products/FSDump/CHANGES.txt 1.14 => 1.15 ===
--- Products/FSDump/CHANGES.txt:1.14 Fri Apr 29 10:22:39 2005
+++ Products/FSDump/CHANGES.txt Tue May 10 14:11:13 2005
@@ -1,5 +1,18 @@
FSDump Change Log
+ After FSDump 0.9
+
+ - Applied patch from Sam Brauer, addressing the following issues:
+
+ o Proxy roles and security settings weren't being written to
+ the '.metadata' file.
+
+ o The '[Default]' section should be named '[default]'.
+
+ o The property-type extensions confuse CMF's FilesystemDirectoryView
+ (the patch removes the ':string' for string properties; others
+ are likely still broken).
+
FSDump 0.9 (2005/04/29)
- Merged Andy Fundinger's work, adding handlers for the following
=== Products/FSDump/Dumper.py 1.14 => 1.15 ===
--- Products/FSDump/Dumper.py:1.14 Fri Apr 29 10:19:30 2005
+++ Products/FSDump/Dumper.py Tue May 10 14:11:13 2005
@@ -139,7 +139,10 @@
fullpath = "%s/%s.%s" % ( self._checkFSPath( path )
, filename, extension )
file = open( fullpath, mode )
- print >> file, "[Default]"
+ if self.use_metadata_file:
+ print >> file, "[default]"
+ else:
+ print >> file, "[Default]"
return file
security.declarePrivate( '_dumpObject' )
@@ -177,7 +180,10 @@
for propID in propIDs:
type = obj.getPropertyType( propID )
value = obj.getProperty( propID )
- file.write( '%s:%s=%s\n' % ( propID, type, value ) )
+ if self.use_metadata_file and type=='string':
+ file.write( '%s=%s\n' % ( propID, value ) )
+ else:
+ file.write( '%s:%s=%s\n' % ( propID, type, value ) )
#
# Type-specific dumpers
@@ -219,13 +225,36 @@
file.write( text )
file.close()
+ security.declarePrivate( '_dumpSecurityInfo' )
+ def _dumpSecurityInfo(self, obj, file):
+ if getattr(obj.aq_base, '_proxy_roles', None):
+ file.write('proxy=%s\n' % ','.join(obj._proxy_roles))
+ security_header_written = 0
+ valid_roles = obj.valid_roles()
+ for perm_dict in obj.permission_settings():
+ perm_name = perm_dict['name']
+ acquire = (perm_dict['acquire'] and 1) or 0
+ roles = []
+ for role_idx in range(len(valid_roles)):
+ if perm_dict['roles'][role_idx]['checked']:
+ roles.append(valid_roles[role_idx])
+ if roles or (acquire==0):
+ if not security_header_written:
+ security_header_written = 1
+ file.write('\n[security]\n')
+ file.write('%s=%d:%s\n' % (perm_name, acquire, ','.join(roles)))
+
security.declarePrivate( '_dumpDTMLMethod' )
def _dumpDTMLMethod( self, obj, path=None ):
# Dump properties of obj (assumed to be a DTML Method) to the
# filesystem as a file, with the accompanyting properties file.
self._dumpDTML( obj, path )
file = self._createMetadataFile( path, '%s.dtml' % obj.id() )
- file.write( 'title:string=%s\n' % obj.title )
+ if self.use_metadata_file:
+ file.write( 'title=%s\n' % obj.title )
+ self._dumpSecurityInfo(obj, file)
+ else:
+ file.write( 'title:string=%s\n' % obj.title )
file.close()
security.declarePrivate( '_dumpDTMLDocument' )
@@ -242,9 +271,15 @@
# Dump properties of obj (assumed to be an Externa Method) to the
# filesystem as a file.
file = self._createMetadataFile( path, '%s.em' % obj.id )
- file.write( 'title:string=%s\n' % obj.title )
- file.write( 'module:string=%s\n' % obj._module )
- file.write( 'function:string=%s\n' % obj._function )
+ if self.use_metadata_file:
+ file.write( 'title=%s\n' % obj.title )
+ file.write( 'module=%s\n' % obj._module )
+ file.write( 'function=%s\n' % obj._function )
+ self._dumpSecurityInfo(obj, file)
+ else:
+ file.write( 'title:string=%s\n' % obj.title )
+ file.write( 'module:string=%s\n' % obj._module )
+ file.write( 'function:string=%s\n' % obj._function )
file.close()
security.declarePrivate( '_dumpFileOrImage' )
@@ -252,9 +287,14 @@
# Dump properties of obj (assumed to be an Externa Method) to the
# filesystem as a file, with the accompanyting properties file.
file = self._createMetadataFile( path, '%s' % obj.id() )
- file.write( 'title:string=%s\n' % obj.title )
- file.write( 'content_type:string=%s\n' % obj.content_type )
- file.write( 'precondition:string=%s\n' % obj.precondition )
+ if self.use_metadata_file:
+ file.write( 'title=%s\n' % obj.title )
+ file.write( 'content_type=%s\n' % obj.content_type )
+ file.write( 'precondition=%s\n' % obj.precondition )
+ else:
+ file.write( 'title:string=%s\n' % obj.title )
+ file.write( 'content_type:string=%s\n' % obj.content_type )
+ file.write( 'precondition:string=%s\n' % obj.precondition )
file.close()
file = self._createFile( path, obj.id(), 'wb' )
data = obj.data
@@ -279,7 +319,11 @@
file.write( text )
file.close()
file = self._createMetadataFile( path, '%s.py' % obj.id )
- file.write( 'title:string=%s\n' % obj.title )
+ if self.use_metadata_file:
+ file.write( 'title=%s\n' % obj.title )
+ self._dumpSecurityInfo(obj, file)
+ else:
+ file.write( 'title:string=%s\n' % obj.title )
file.close()
security.declarePrivate( '_dumpPythonScript' )
@@ -290,7 +334,11 @@
file.write( obj.read() )
file.close()
file = self._createMetadataFile( path, '%s.py' % obj.id )
- file.write( 'title:string=%s\n' % obj.title )
+ if self.use_metadata_file:
+ file.write( 'title=%s\n' % obj.title )
+ self._dumpSecurityInfo(obj, file)
+ else:
+ file.write( 'title:string=%s\n' % obj.title )
file.close()
security.declarePrivate( '_dumpControllerPythonScript' )
@@ -334,7 +382,11 @@
file.write( obj.read() )
file.close()
file = self._createMetadataFile( path, '%s.pt' % obj.id )
- file.write( 'title:string=%s\n' % obj.title )
+ if self.use_metadata_file:
+ file.write( 'title=%s\n' % obj.title )
+ self._dumpSecurityInfo(obj, file)
+ else:
+ file.write( 'title:string=%s\n' % obj.title )
file.close()
security.declarePrivate( '_dumpSQLMethod' )
=== Products/FSDump/version.txt 1.9 => 1.10 ===
--- Products/FSDump/version.txt:1.9 Fri Apr 29 10:22:39 2005
+++ Products/FSDump/version.txt Tue May 10 14:11:14 2005
@@ -1 +1 @@
-0.9
+0.9+
More information about the Zope-CVS
mailing list