[Zope] weird urllib.addinfourl problem found via RDFSummary

Marc Lindahl marc at bowery.com
Wed Jul 21 14:22:51 EDT 2004


I ran into a weird problem with urllib recently (python 2.1.3 that 
comes with zope 2.6.2)... I would get an error that an __init__ needed 
to be called with an instance as the first argument (unbound method)... 
from within urllib, when RDFSummary tried to open a URL.  Well, 
monkeypatching urllib fixes it.  But I'm wondering, is this a known 
issue or is there something mutated about my setup?  Here's the 
monkeypatch:

#Monkeypatch urllib due to:
#http://mail.zope.org/pipermail/zope/2004-February/146824.html

import urllib
#from urllib import addinfourl, addbase

#    """class to add info() and geturl() methods to an open file."""


__super_init = urllib.addbase.__init__

def __init__(self, fp, headers, url):
   __super_init(self, fp)
   self.headers = headers
   self.url = url

urllib.addinfourl.__super_init = __super_init
urllib.addinfourl.__init__ = __init__





More information about the Zope mailing list