[Zodb-checkins] CVS: Zope3/src/zodb - utils.py:1.2.18.2

Jeremy Hylton jeremy@zope.com
Mon, 3 Mar 2003 18:24:54 -0500


Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv10791

Modified Files:
      Tag: jeremy-atomic-invalidation-branch
	utils.py 
Log Message:
Add a hackish constructor for Set()


=== Zope3/src/zodb/utils.py 1.2.18.1 => 1.2.18.2 ===
--- Zope3/src/zodb/utils.py:1.2.18.1	Mon Mar  3 17:10:35 2003
+++ Zope3/src/zodb/utils.py	Mon Mar  3 18:24:53 2003
@@ -45,6 +45,14 @@
     # This must be Python 2.2, which doesn't have a standard sets module.
     # ZODB needs only a very limited subset of the Set API.
     class Set(dict):
+        def __init__(self, arg=None):
+            if arg:
+                if isinstance(arg, dict):
+                    self.update(arg)
+                else:
+                    # XXX the proper sets version is much more robust
+                    for o in arg:
+                        self[o] = 1
         def add(self, o):
             self[o] = 1
         def remove(self, o):
@@ -54,3 +62,4 @@
                 return NotImplemented
             self.update(other)
             return self
+