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

Guido van Rossum guido@python.org
Thu, 15 May 2003 13:32:46 -0400


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

Modified Files:
	syncer.py 
Log Message:
Matching hacks to support committing the root folder.
This doesn't make any changes to the root folder, but commits its contents.


=== Zope3/src/zope/app/fssync/syncer.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/fssync/syncer.py:1.14	Tue May 13 15:58:56 2003
+++ Zope3/src/zope/app/fssync/syncer.py	Thu May 15 13:32:46 2003
@@ -168,6 +168,22 @@
 
     location -- filesystem directory containing name
     """
+    if not name:
+        # Special case: loading the root folder.
+        # Don't make changes to the root, but change everything underneath.
+        path = os.path.join(location, "root")
+        if not os.path.isdir(path):
+            raise SynchronizationError("root folder not found")
+
+        dir_entries_path = os.path.join(path, '@@Zope', 'Entries.xml')
+        if os.path.exists(dir_entries_path):
+            dir_entries = loadFile(dir_entries_path)
+        else:
+            dir_entries = {}
+        for cname in dir_entries:
+            fromFS(container, cname, path)
+
+        return
 
     # Look for location admin dir
     admin_dir = os.path.join(location, '@@Zope')