SVN: GenericSetup/trunk/ Allowed subclasses of DAVAwareFileAdapter to override the filename in which the file is stored.

Tres Seaver <[email protected]> Fri, 17 Feb 2006 17:10:23 -0500 (EST)
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Log message for revision 41651:
  Allowed subclasses of DAVAwareFileAdapter to override the filename in which the file is stored.
  
  

Changed:
  U   GenericSetup/trunk/CHANGES.txt
  U   GenericSetup/trunk/content.py

-=-
Modified: GenericSetup/trunk/CHANGES.txt
===================================================================
--- GenericSetup/trunk/CHANGES.txt	2006-02-17 22:01:38 UTC (rev 41650)
+++ GenericSetup/trunk/CHANGES.txt	2006-02-17 22:10:23 UTC (rev 41651)
@@ -2,6 +2,9 @@
 
   After GenericSetup 1.0
 
+    - Allowed subclasses of DAVAwareFileAdapter to override the filename
+      in which the file is stored.
+
     - Added a doc directory including some basic documentation.
 
     - Made GenericSetup a standalone package independent of the CMF

Modified: GenericSetup/trunk/content.py
===================================================================
--- GenericSetup/trunk/content.py	2006-02-17 22:01:38 UTC (rev 41650)
+++ GenericSetup/trunk/content.py	2006-02-17 22:10:23 UTC (rev 41651)
@@ -376,10 +376,15 @@
     def __init__(self, context):
         self.context = context
 
+    def _getFileName(self):
+        """ Return the name under which our file data is stored.
+        """
+        return '%s' % self.context.getId()
+
     def export(self, export_context, subdir, root=False):
         """ See IFilesystemExporter.
         """
-        export_context.writeDataFile('%s' % self.context.getId(),
+        export_context.writeDataFile(self._getFileName(),
                                      self.context.manage_FTPget(),
                                      'text/plain',
                                      subdir,
@@ -394,7 +399,7 @@
         """ See IFilesystemImporter.
         """
         cid = self.context.getId()
-        data = import_context.readDataFile('%s' % cid, subdir)
+        data = import_context.readDataFile(self._getFileName(), subdir)
         if data is None:
             logger = import_context.getLogger('SGAIFA')
             logger.info('no .ini file for %s/%s' % (subdir, cid))

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS