[Zope-dev] funky side-effects, possible bug in HTTPRequest.py

Jamie Heilman jamie@audible.transient.net
Fri, 20 Jun 2003 13:28:46 -0700


Dieter Maurer wrote:
> Zope promotes the variables from "cookies" and "form" to "other"
> at least since Zope 2.1.6 (the first version I worked with).
> 
> I think this is for efficiency reasons. You have a single
> dictionary lookup instead of three ("other", "form", "cookie").

Yeah most promotion is for efficiency, but since 2.1.6 eh?
Interesting, that means its happening elsewhere too.  Hmm.  Yeah, I
see, it happens in __init__ for cookies, mmm and in processInputs for
form variables I guess.  The difference I can see is two fold, first,
before 1.75 I believe promotion of form and cookies was only done
during request object creation, interestingly, its not done there
anymore from the looks of it; cookies and form vars are kept in their
seperate tainted & non-tainted buckets until they are fetched.  Second
the promotion of cookies wouldn't clobber pre-existing keys in
other, interestingly, in 2.1.6 times, form vars would clober normal
other vars (URLx, BASEx, etc.).

I must admit, this isn't the biggest deal to me, I just blew quite a
bit of time tracking it down because I couldn't understand why the
promotion was happening and I don't like surprises, and nothing about
"def foo(self, bar, baz):" immediately jumped out and said to me,
"promote bar and baz form vars and cookies to the other dictionary."
Now that I have an appreciation for exactly how methods are published,
I see things in a different light of course.

-- 
Jamie Heilman                   http://audible.transient.net/~jamie/
"...thats the metaphorical equivalent of flopping your wedding tackle 
 into a lion's mouth and flicking his lovespuds with a wet towel, pure 
 insanity..."						-Rimmer