[CMF-checkins] CVS: CMF/CMFCollector - Collector.py:1.28
Ken Manheimer
klm@zope.com
Wed, 27 Mar 2002 18:56:40 -0500
Update of /cvs-repository/CMF/CMFCollector
In directory cvs.zope.org:/tmp/cvs-serv7042
Modified Files:
Collector.py
Log Message:
Ensure that the .state_email attribute settings is instance-specific.
.edit(): When setting state_email, use a copy of the dictionary, not
the actual dictionary, so instances are assured to have distinct
copies.
=== CMF/CMFCollector/Collector.py 1.27 => 1.28 ===
if state_email is not None:
changed = 0
+ # Use a new dict, to ensure it's divorced from shared class
+ # variable hood.
+ se = {}
+ se.update(self.state_email)
for k, v in state_email.items():
- current_setting = self.state_email.get(k, None)
+ current_setting = se.get(k, None)
if ( ((not current_setting) and v)
or (current_setting and (current_setting != v)) ):
changed = 1
- self.state_email[k] = v
+ if not v:
+ del se[k]
+ else:
+ se[k] = v
if changed:
+ self.state_email = se
changes.append("State email")
if topics is not None:
@@ -525,4 +533,3 @@
except: url=REQUEST['URL1']
REQUEST.RESPONSE.redirect('%s/manage_main' % url)
return id
-