[Zope3-checkins] CVS: Zope3/src/zope/fssync/tests - tempfiles.py:1.2

Guido van Rossum guido@python.org
Wed, 28 May 2003 10:47:58 -0400


Update of /cvs-repository/Zope3/src/zope/fssync/tests
In directory cvs.zope.org:/tmp/cvs-serv2580

Modified Files:
	tempfiles.py 
Log Message:
Add a feature to writefile(): call makedirs() if necessary.


=== Zope3/src/zope/fssync/tests/tempfiles.py 1.1 => 1.2 ===
--- Zope3/src/zope/fssync/tests/tempfiles.py:1.1	Wed May 28 10:40:04 2003
+++ Zope3/src/zope/fssync/tests/tempfiles.py	Wed May 28 10:47:57 2003
@@ -70,6 +70,9 @@
     def writefile(self, data, fn, mode="w"):
         """Write data to a given file."""
         assert mode in ("w", "wb")
+        dn = os.path.dirname(fn)
+        if not os.path.exists(dn):
+            os.makedirs(dn)
         f = open(fn, mode)
         try:
             f.write(data)