Merge lp:~stefanor/ibid/html5lib-524660 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Stefano Rivera
Status: Merged
Approved by: Jonathan Hitchcock
Approved revision: not available
Merged at revision: 895
Proposed branch: lp:~stefanor/ibid/html5lib-524660
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 29 lines (+8/-4)
1 file modified
ibid/utils/html.py (+8/-4)
To merge this branch: bzr merge lp:~stefanor/ibid/html5lib-524660
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
marcog (community) Approve
Michael Gorven Approve
Review via email: mp+19748@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve

review: Approve
Revision history for this message
marcog (marco-gallotta) wrote :

Query: exchange 1 usd to zar
ERROR:scripts.ibid-plugin:Exception occured in Currency processor of conversions plugin
Traceback (most recent call last):
  File "/home/marco/ibid/html5lib-524660/scripts/ibid-plugin", line 129, in <module>
    processor.process(event)
  File "./ibid/plugins/__init__.py", line 119, in process
    method(event, *match.groups())
  File "./ibid/plugins/conversions.py", line 368, in exchange
    self._load_currencies()
  File "./ibid/plugins/conversions.py", line 303, in _load_currencies
    etree = get_html_parse_tree('http://www.xe.com/iso4217.php', headers=self.headers, treetype='etree')
  File "./ibid/utils/html.py", line 55, in get_html_parse_tree
    namespaceHTMLElements=False)
TypeError: __init__() got an unexpected keyword argument 'namespaceHTMLElements'

review: Needs Fixing
lp:~stefanor/ibid/html5lib-524660 updated
891. By Stefano Rivera

Support old html5libs too

Revision history for this message
Stefano Rivera (stefanor) wrote :

> TypeError: __init__() got an unexpected keyword argument
> 'namespaceHTMLElements'

Fixed in r891.

Revision history for this message
marcog (marco-gallotta) :
review: Approve
Revision history for this message
Jonathan Hitchcock (vhata) wrote :

Nice.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ibid/utils/html.py'
--- ibid/utils/html.py 2010-01-21 14:19:42 +0000
+++ ibid/utils/html.py 2010-02-21 10:14:15 +0000
@@ -2,6 +2,7 @@
2# Released under terms of the MIT/X/Expat Licence. See COPYING for details.2# Released under terms of the MIT/X/Expat Licence. See COPYING for details.
33
4import cgi4import cgi
5import inspect
5import zlib6import zlib
6import urllib27import urllib2
7from gzip import GzipFile8from gzip import GzipFile
@@ -50,11 +51,14 @@
50 if treetype == "beautifulsoup":51 if treetype == "beautifulsoup":
51 return BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)52 return BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
52 elif treetype == "etree":53 elif treetype == "etree":
53 treebuilder = treebuilders.getTreeBuilder("etree", ElementTree)54 kwargs = {'tree': treebuilders.getTreeBuilder('etree', ElementTree)}
55 # http://code.google.com/p/html5lib/issues/detail?id=138
56 if ('namespaceHTMLElements'
57 in inspect.getargspec(HTMLParser.__init__)[0]):
58 kwargs['namespaceHTMLElements'] = False
59 parser = HTMLParser(**kwargs)
54 else:60 else:
55 treebuilder = treebuilders.getTreeBuilder(treetype)61 parser = HTMLParser(tree=treebuilders.getTreeBuilder(treetype))
56
57 parser = HTMLParser(tree=treebuilder)
5862
59 return parser.parse(data, encoding = encoding)63 return parser.parse(data, encoding = encoding)
6064

Subscribers

People subscribed via source and target branches