[Zope3-checkins] CVS: Zope3/src/zope/fssync - metadata.py:1.4

Guido van Rossum guido@python.org
Wed, 4 Jun 2003 17:18:34 -0400


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

Modified Files:
	metadata.py 
Log Message:
Only write an empty Entries.xml if the file already exists.


=== Zope3/src/zope/fssync/metadata.py 1.3 => 1.4 ===
--- Zope3/src/zope/fssync/metadata.py:1.3	Wed Jun  4 15:00:37 2003
+++ Zope3/src/zope/fssync/metadata.py	Wed Jun  4 17:18:34 2003
@@ -114,12 +114,13 @@
                     live[name] = entry
             zdir = join(key, "@@Zope")
             efile = join(zdir, "Entries.xml")
-            data = dumps(live)
-            if not exists(zdir):
-                os.makedirs(zdir)
-            f = open(efile, "w")
-            try:
-                f.write(data)
-            finally:
-                f.close()
+            if exists(efile) or live:
+                data = dumps(live)
+                if not exists(zdir):
+                    os.makedirs(zdir)
+                f = open(efile, "w")
+                try:
+                    f.write(data)
+                finally:
+                    f.close()
             self.originals[key] = copy.deepcopy(entries)