diff options
author | Leonard Richardson <leonardr@segfault.org> | 2012-05-24 08:28:14 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2012-05-24 08:28:14 -0400 |
commit | 34c036cde4ed75e000be2d29f542a3f9ec215dfa (patch) | |
tree | f7da41504e50da02587ac4acd0d8a93ae2f50f70 /bs4/builder/_lxml.py | |
parent | c84e08aa77764578ca1be2a322a4a7bed12d6851 (diff) |
Fixed a bug with the lxml treebuilder that prevented the user from adding attributes to a tag that didn't originally have any. [bug=1002378] Thanks to Oliver Beattie for the patch.
Diffstat (limited to 'bs4/builder/_lxml.py')
-rw-r--r-- | bs4/builder/_lxml.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bs4/builder/_lxml.py b/bs4/builder/_lxml.py index 6491322..c78fdff 100644 --- a/bs4/builder/_lxml.py +++ b/bs4/builder/_lxml.py @@ -88,6 +88,9 @@ class LXMLTreeBuilderForXML(TreeBuilder): self.nsmaps = None def start(self, name, attrs, nsmap={}): + # Make sure attrs is a mutable dict--lxml may send an immutable dictproxy. + attrs = dict(attrs) + nsprefix = None # Invert each namespace map as it comes in. if len(nsmap) == 0 and self.nsmaps != None: |