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

Guido van Rossum guido@python.org
Mon, 2 Jun 2003 16:44:42 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/content
In directory cvs.zope.org:/tmp/cvs-serv5405

Modified Files:
	fssync.py 
Log Message:
After a commit, don't rely on the commit to update the tree; do a
fresh toFS() instead.  I can now get rid of all writing back of
changes in the Committer class.


=== Zope3/src/zope/app/browser/content/fssync.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/browser/content/fssync.py:1.14	Wed May 28 15:58:50 2003
+++ Zope3/src/zope/app/browser/content/fssync.py	Mon Jun  2 16:44:41 2003
@@ -106,7 +106,14 @@
             # 4) Generate response (snarfed archive or error text)
             errors = c.get_errors()
             if not errors:
+                # The flush() isn't really needed, but it's better to
+                # waste some cycles now than to have this corrupt some
+                # files later.
                 md.flush()
+                # Do a fresh toFS(), to be sure to get all changes
+                shutil.rmtree(working)
+                os.mkdir(working)
+                toFS(self.context, objectName(self.context) or "root", working)
                 return snarf_dir(self.request.response, working)
             else:
                 txn.abort()
@@ -118,7 +125,5 @@
                 self.request.response.setHeader("Content-Type", "text/plain")
                 return "\n".join(lines)
         finally:
-            try:
+            if os.path.exists(working):
                 shutil.rmtree(working)
-            except os.error:
-                pass