I'm having an odd problem with the RDFSummary product, although I'm not sure that the problem is with the product itself. It appears that either this product or a Python XML parsing function is converting "&" into "&", instead of "&". Browsers don't seem to mind, but Zope's TAL parser evidently doesn't recognize "&" as an entity (not that it should), and so escapes the ampersand on output. Since tal:attributes doesn't support a "structure"-like operation, I had to write a custom script to produce links for my RSS feed. Anyway, I'd like to know where this incorrect conversion is happening so I can address it appropriately. Thanks! David -- David Chandek-Stark Web Applications Developer Duke University - Perkins Library (919) 660-5859 dc@duke.edu
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__
Marc Lindahl wrote at 2004-7-21 14:22 -0400:
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?
The problem is in principle known and documented in the "ExtensionClass" documentation -- together with a work around. I am not sure whether the specific problem is know. Maybe, you contact the "RDFSummary" author? -- Dieter
On Thursday, July 22, 2004, at 03:33 PM, Dieter Maurer wrote:
Marc Lindahl wrote at 2004-7-21 14:22 -0400:
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?
The problem is in principle known and documented in the "ExtensionClass" documentation -- together with a work around.
Yes, as you see from my example I patched the class in urllib with the prescribed workaround, and it works. But it's odd that I have to patch a core python library, that's what I am referring to when I ask if it's a known problem....
I am not sure whether the specific problem is know. Maybe, you contact the "RDFSummary" author?
AFAIK there is nothing specific to that product, it's using open() etc in exactly the prescribed manner (of course there are other problems with that product, especially the inadequate home-made parser). Just that it was the first time I'm using something to exercise that library call AFAIK.
-- Dieter
David Chandek-Stark wrote at 2004-7-20 15:46 -0400:
It appears that either this product or a Python XML parsing function is converting "&" into "&", instead of "&". Browsers don't seem to mind, but Zope's TAL parser evidently doesn't recognize "&" as an entity (not that it should)
The XML spec (following the SGML spec) allows "[0-9]+;" as character entity references. Therfore, the "0" is not necessary and "&" is perfectly valid. I fear however, that the HTML parser used by TAL does not recognize any entity reference but passes them unchanged. If they happen to appear in a place where HTML quoting is active they get quoted. -- Dieter
participants (3)
-
David Chandek-Stark -
Dieter Maurer -
Marc Lindahl