[Zope-dev] funky side-effects, possible bug in HTTPRequest.py
Florent Guillaume
fg@nuxeo.com
Mon, 23 Jun 2003 13:44:25 +0200
In article <20030620100717.GE8282@audible.transient.net> you write:
>
> # Untrusted data *after* trusted data
> v = self.form.get(key, _marker)
> if v is not _marker:
> other[key] = v # *boom*
> return v
>
> That magical promotion of the key & value to the other dictionary is
> what tripped me up.
Wouldn't
other.setdefault(key, v)
be better?
So a variable already existing in other wouldn't get clobbered.
Florent
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com