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

Guido van Rossum guido@python.org
Thu, 5 Jun 2003 10:04:26 -0400


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

Modified Files:
	metadata.py 
Log Message:
Rewrite flushkey() again; it should really construct the set of live
entries and compare *it* to the originals, and copy it to the
originals if changed.


=== Zope3/src/zope/fssync/metadata.py 1.4 => 1.5 ===
--- Zope3/src/zope/fssync/metadata.py:1.4	Wed Jun  4 17:18:34 2003
+++ Zope3/src/zope/fssync/metadata.py	Thu Jun  5 10:04:25 2003
@@ -106,12 +106,12 @@
 
     def flushkey(self, key):
         entries = self.cache[key]
-        if entries != self.originals[key]:
-            # Make a copy containing only the "live" (non-empty) entries
-            live = {}
-            for name, entry in entries.iteritems():
-                if entry:
-                    live[name] = entry
+        # Make a copy containing only the "live" (non-empty) entries
+        live = {}
+        for name, entry in entries.iteritems():
+            if entry:
+                live[name] = entry
+        if live != self.originals[key]:
             zdir = join(key, "@@Zope")
             efile = join(zdir, "Entries.xml")
             if exists(efile) or live:
@@ -123,4 +123,4 @@
                     f.write(data)
                 finally:
                     f.close()
-            self.originals[key] = copy.deepcopy(entries)
+            self.originals[key] = copy.deepcopy(live)