[Zope3-checkins] CVS: Zope3/src/zope/app/fssync - committer.py:1.15

Guido van Rossum guido@python.org
Mon, 16 Jun 2003 11:55:48 -0400


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

Modified Files:
	committer.py 
Log Message:
Change synch_dir to synch non-directories before descending into
subdirectories.


=== Zope3/src/zope/app/fssync/committer.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/fssync/committer.py:1.14	Fri Jun 13 13:41:18 2003
+++ Zope3/src/zope/app/fssync/committer.py	Mon Jun 16 11:55:48 2003
@@ -257,17 +257,25 @@
         nameset = {}
         if IObjectDirectory.isImplementedBy(adapter):
             for name, obj in adapter.contents():
-                nameset[name] = 1
+                nameset[name] = os.path.join(fspath, name)
         else:
             for name in container:
-                nameset[name] = 1
+                nameset[name] = os.path.join(fspath, name)
         for name in self.metadata.getnames(fspath):
-            nameset[name] = 1
+            nameset[name] = os.path.join(fspath, name)
         # Sort the list of keys for repeatability
-        names = nameset.keys()
-        names.sort()
-        for name in names:
-            self.synch(container, name, os.path.join(fspath, name))
+        names_paths = nameset.items()
+        names_paths.sort()
+        subdirs = []
+        # Do the non-directories first
+        for name, path in names_paths:
+            if os.path.isdir(path):
+                subdirs.append((name, path))
+            else:
+                self.synch(container, name, path)
+        # Now do the directories
+        for name, path in subdirs:
+            self.synch(container, name, path)
 
     def synch_new(self, container, name, fspath):
         """Helper to synchronize a new object."""