Passing a CookieJar instead of a cookieproc to urllib2.build_opener

John J. Lee jjl at
Wed Jul 11 01:10:26 CEST 2007

"rrenaud at" <rrenaud at> writes:

> urllib2.build_opener happily accepts and ignores a FileCookieJar.    I
> had a bug in my code which looked like
> urllib2.build_opener(func_returning_cookie_jar())
> which should have been
> urllib2.build_opener(HTTPCookieProcessor(func_returning_cookie_jar())
> The problem is that the code ran happily without actually sending the
> cookie, the CookieJar was just ignored.  I think that build_opener
> should throw an exception when add_handler doesn't actually add.
> Is this worth filing a bug for, or is it acceptable behavior?

IMO, it's worth filing iff:

a) you think it's worthwhile (this one sounds worthwhile to me)

b) you write a patch and are prepared to patiently keep at it until it
gets applied

Make sure your patch follows PEP 8.  Make sure the patch includes test
and documentation updates / additions (you don't need to write docs in
LaTeX format -- other people will do the conversion to LaTeX for you
if you like).  If there are no doc changes required, state that
explicitly in the patch tracker.  If your patch gets ignored, review
five other patches, and post to python-dev stating you have done so
and requesting that your patch is reviewed (there's a shortage of
patch reviewers).


More information about the Python-list mailing list