[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/testing.py don't mutate globs, so that they can be reused

Gary Poster gary at zope.com
Tue Jan 23 16:22:56 EST 2007


Log message for revision 72200:
  don't mutate globs, so that they can be reused

Changed:
  U   Zope3/trunk/src/zope/testbrowser/testing.py

-=-
Modified: Zope3/trunk/src/zope/testbrowser/testing.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/testing.py	2007-01-23 20:47:16 UTC (rev 72199)
+++ Zope3/trunk/src/zope/testbrowser/testing.py	2007-01-23 21:22:56 UTC (rev 72200)
@@ -211,7 +211,10 @@
     layer = kw.pop('layer', None)
     normalizers = kw.pop('normalizers', None)
     vh_kw = kw.copy()
-    globs = kw.setdefault('globs', {})
+    if 'globs' in kw:
+        globs = kw['globs'] = kw['globs'].copy() # don't mutate the original
+    else:
+        globs = kw['globs'] = {}
     if 'Browser' in globs:
         raise ValueError('"Browser" must not be defined in globs')
     vh_kw['globs'] = globs.copy()



More information about the Zope3-Checkins mailing list