Issue #60 resolved

.replaceWith(PyQuery element) raises error

Anonymous created an issue

Using .replaceWith(PyQuery element) raises an error. This is in pyquery-1.2.1 from PyPI.

{{{

!python

from pyquery import PyQuery as pq root = pq("""<root><child/></root>""") replace = pq("""<replace/>""") child = root.find('child') child.replaceWith(replace)

Raises

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/pyquery/pyquery.py", line 1174, in replaceWith value(i, element) + (element.tail or '')) File "/usr/local/lib/python2.7/dist-packages/pyquery/pyquery.py", line 247, in call result = self.class(args, parent=self, *kwargs) File "/usr/local/lib/python2.7/dist-packages/pyquery/pyquery.py", line 221, in init xpath = self._css_to_xpath(selector) File "/usr/local/lib/python2.7/dist-packages/pyquery/pyquery.py", line 232, in _css_to_xpath selector = selector.replace('[@', '[') AttributeError: 'int' object has no attribute 'replace'

}}}