Hello community, here is the log from the commit of package python3-pyquery for openSUSE:Factory checked in at 2016-02-08 09:47:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-pyquery (Old) and /work/SRC/openSUSE:Factory/.python3-pyquery.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python3-pyquery" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-pyquery/python3-pyquery.changes 2016-02-01 19:57:17.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python3-pyquery.new/python3-pyquery.changes 2016-02-08 09:47:29.000000000 +0100 @@ -1,0 +2,7 @@ +Wed Feb 3 01:36:49 UTC 2016 - arun@gmx.de + +- update to version 1.2.11: + * Preserve namespaces attribute on PyQuery copies. + * Do not raise an error when the http response code is 2XX + +------------------------------------------------------------------- Old: ---- pyquery-1.2.10.tar.gz New: ---- pyquery-1.2.11.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-pyquery.spec ++++++ --- /var/tmp/diff_new_pack.SDPb5V/_old 2016-02-08 09:47:30.000000000 +0100 +++ /var/tmp/diff_new_pack.SDPb5V/_new 2016-02-08 09:47:30.000000000 +0100 @@ -17,7 +17,7 @@ Name: python3-pyquery -Version: 1.2.10 +Version: 1.2.11 Release: 0 Summary: A jQuery-like library for python License: BSD-3-Clause ++++++ pyquery-1.2.10.tar.gz -> pyquery-1.2.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.10/CHANGES.rst new/pyquery-1.2.11/CHANGES.rst --- old/pyquery-1.2.10/CHANGES.rst 2016-01-05 13:50:44.000000000 +0100 +++ new/pyquery-1.2.11/CHANGES.rst 2016-02-02 12:41:44.000000000 +0100 @@ -1,3 +1,10 @@ +1.2.11 (2016-02-02) +------------------- + +- Preserve namespaces attribute on PyQuery copies. + +- Do not raise an error when the http response code is 2XX + 1.2.10 (2016-01-05) ------------------- @@ -52,110 +59,109 @@ 1.2.6 (2013-10-11) ------------------ -README_fixt.py was not include in the release. Fix #54. +- README_fixt.py was not include in the release. Fix #54. 1.2.5 (2013-10-10) ------------------ -cssselect compat. See https://github.com/SimonSapin/cssselect/pull/22 +- cssselect compat. See https://github.com/SimonSapin/cssselect/pull/22 -tests improvments. no longer require a eth connection. +- tests improvments. no longer require a eth connection. -fix #55 +- fix #55 1.2.4 ----- -Moved to github. So a few files are renamed from .txt to .rst +- Moved to github. So a few files are renamed from .txt to .rst -Added .xhtml_to_html() and .remove_namespaces() +- Added .xhtml_to_html() and .remove_namespaces() -Use requests to fetch urls (if available) +- Use requests to fetch urls (if available) -Use restkit's proxy instead of Paste (which will die with py3) +- Use restkit's proxy instead of Paste (which will die with py3) -Allow to open https urls +- Allow to open https urls -python2.5 is no longer supported (may work, but tests are broken) +- python2.5 is no longer supported (may work, but tests are broken) 1.2.3 ----- -Allow to pass this in .filter() callback +- Allow to pass this in .filter() callback -Add .contents() .items() +- Add .contents() .items() -Add tox.ini +- Add tox.ini -Bug fixes: fix #35 #55 #64 #66 +- Bug fixes: fix #35 #55 #64 #66 1.2.2 ----- -Fix cssselectpatch to match the newer implementation of cssselect. Fixes issue #62, #52 and #59 (Haoyu Bai) +- Fix cssselectpatch to match the newer implementation of cssselect. Fixes issue #62, #52 and #59 (Haoyu Bai) -Fix issue #37 (Caleb Burns) +- Fix issue #37 (Caleb Burns) 1.2.1 ----- -Allow to use a custom css translator. +- Allow to use a custom css translator. -Fix issue 44: case problem with xml documents +- Fix issue 44: case problem with xml documents 1.2 --- -PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue -43. +- PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. -Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` +- Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` 1.1.1 ----- -Minor release. Include test file so you can run tests from the tarball. +- Minor release. Include test file so you can run tests from the tarball. 1.1 --- -fix issues 30, 31, 32 - py3 improvements / webob 1.2+ support +- fix issues 30, 31, 32 - py3 improvements / webob 1.2+ support 1.0 --- -fix issues 24 +- fix issues 24 0.7 --- -Python 3 compatible +- Python 3 compatible -Add __unicode__ method +- Add __unicode__ method -Add root and encoding attribute +- Add root and encoding attribute -fix issues 19, 20, 22, 23 +- fix issues 19, 20, 22, 23 0.6.1 ------ -Move README.txt at package root +- Move README.txt at package root -Add CHANGES.txt and add it to long_description +- Add CHANGES.txt and add it to long_description 0.6 ---- -Added PyQuery.outerHtml +- Added PyQuery.outerHtml -Added PyQuery.fn +- Added PyQuery.fn -Added PyQuery.map +- Added PyQuery.map -Change PyQuery.each behavior to reflect jQuery api +- Change PyQuery.each behavior to reflect jQuery api diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.10/PKG-INFO new/pyquery-1.2.11/PKG-INFO --- old/pyquery-1.2.10/PKG-INFO 2016-01-05 13:50:56.000000000 +0100 +++ new/pyquery-1.2.11/PKG-INFO 2016-02-02 12:41:58.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyquery -Version: 1.2.10 +Version: 1.2.11 Summary: A jquery-like library for python Home-page: https://github.com/gawel/pyquery Author: Gael Pasgrimaud @@ -73,6 +73,13 @@ News ==== + 1.2.11 (2016-02-02) + ------------------- + + - Preserve namespaces attribute on PyQuery copies. + + - Do not raise an error when the http response code is 2XX + 1.2.10 (2016-01-05) ------------------- @@ -127,111 +134,110 @@ 1.2.6 (2013-10-11) ------------------ - README_fixt.py was not include in the release. Fix #54. + - README_fixt.py was not include in the release. Fix #54. 1.2.5 (2013-10-10) ------------------ - cssselect compat. See https://github.com/SimonSapin/cssselect/pull/22 + - cssselect compat. See https://github.com/SimonSapin/cssselect/pull/22 - tests improvments. no longer require a eth connection. + - tests improvments. no longer require a eth connection. - fix #55 + - fix #55 1.2.4 ----- - Moved to github. So a few files are renamed from .txt to .rst + - Moved to github. So a few files are renamed from .txt to .rst - Added .xhtml_to_html() and .remove_namespaces() + - Added .xhtml_to_html() and .remove_namespaces() - Use requests to fetch urls (if available) + - Use requests to fetch urls (if available) - Use restkit's proxy instead of Paste (which will die with py3) + - Use restkit's proxy instead of Paste (which will die with py3) - Allow to open https urls + - Allow to open https urls - python2.5 is no longer supported (may work, but tests are broken) + - python2.5 is no longer supported (may work, but tests are broken) 1.2.3 ----- - Allow to pass this in .filter() callback + - Allow to pass this in .filter() callback - Add .contents() .items() + - Add .contents() .items() - Add tox.ini + - Add tox.ini - Bug fixes: fix #35 #55 #64 #66 + - Bug fixes: fix #35 #55 #64 #66 1.2.2 ----- - Fix cssselectpatch to match the newer implementation of cssselect. Fixes issue #62, #52 and #59 (Haoyu Bai) + - Fix cssselectpatch to match the newer implementation of cssselect. Fixes issue #62, #52 and #59 (Haoyu Bai) - Fix issue #37 (Caleb Burns) + - Fix issue #37 (Caleb Burns) 1.2.1 ----- - Allow to use a custom css translator. + - Allow to use a custom css translator. - Fix issue 44: case problem with xml documents + - Fix issue 44: case problem with xml documents 1.2 --- - PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue - 43. + - PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. - Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` + - Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` 1.1.1 ----- - Minor release. Include test file so you can run tests from the tarball. + - Minor release. Include test file so you can run tests from the tarball. 1.1 --- - fix issues 30, 31, 32 - py3 improvements / webob 1.2+ support + - fix issues 30, 31, 32 - py3 improvements / webob 1.2+ support 1.0 --- - fix issues 24 + - fix issues 24 0.7 --- - Python 3 compatible + - Python 3 compatible - Add __unicode__ method + - Add __unicode__ method - Add root and encoding attribute + - Add root and encoding attribute - fix issues 19, 20, 22, 23 + - fix issues 19, 20, 22, 23 0.6.1 ------ - Move README.txt at package root + - Move README.txt at package root - Add CHANGES.txt and add it to long_description + - Add CHANGES.txt and add it to long_description 0.6 ---- - Added PyQuery.outerHtml + - Added PyQuery.outerHtml - Added PyQuery.fn + - Added PyQuery.fn - Added PyQuery.map + - Added PyQuery.map - Change PyQuery.each behavior to reflect jQuery api + - Change PyQuery.each behavior to reflect jQuery api diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.10/pyquery/openers.py new/pyquery-1.2.11/pyquery/openers.py --- old/pyquery-1.2.10/pyquery/openers.py 2016-01-05 13:50:44.000000000 +0100 +++ new/pyquery-1.2.11/pyquery/openers.py 2016-02-02 12:41:44.000000000 +0100 @@ -56,8 +56,9 @@ if k in kwargs: kw[k] = kwargs[k] resp = meth(url=url, **kw) - if resp.status_code != 200: - raise HTTPError(resp.url, resp.status_code, resp.reason, resp.headers, None) + if not (200 <= resp.status_code < 300): + raise HTTPError(resp.url, resp.status_code, + resp.reason, resp.headers, None) if encoding: resp.encoding = encoding html = resp.text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.10/pyquery/pyquery.py new/pyquery-1.2.11/pyquery/pyquery.py --- old/pyquery-1.2.10/pyquery/pyquery.py 2016-01-05 13:50:44.000000000 +0100 +++ new/pyquery-1.2.11/pyquery/pyquery.py 2016-02-02 12:41:44.000000000 +0100 @@ -179,7 +179,7 @@ else: self._translator = self._translator_class(xhtml=False) - namespaces = kwargs.pop('namespaces', {}) + self.namespaces = kwargs.pop('namespaces', None) if kwargs: # specific case to get the dom @@ -239,7 +239,7 @@ xpath = self._css_to_xpath(selector) results = [] for tag in elements: - results.extend(tag.xpath(xpath, namespaces=namespaces)) + results.extend(tag.xpath(xpath, namespaces=self.namespaces)) elements = results list.__init__(self, elements) @@ -248,6 +248,10 @@ selector = selector.replace('[@', '[') return self._translator.css_to_xpath(selector, prefix) + def _copy(self, *args, **kwargs): + kwargs.setdefault('namespaces', self.namespaces) + return self.__class__(*args, **kwargs) + def __call__(self, *args, **kwargs): """return a new PyQuery instance """ @@ -255,13 +259,13 @@ if length == 0: raise ValueError('You must provide at least a selector') if args[0] == '': - return self.__class__([]) + return self._copy([]) if (len(args) == 1 and (not PY3k and isinstance(args[0], basestring) or (PY3k and isinstance(args[0], str))) and not args[0].startswith('<')): args += (self,) - result = self.__class__(*args, parent=self, **kwargs) + result = self._copy(*args, parent=self, **kwargs) return result # keep original list api prefixed with _ @@ -271,7 +275,7 @@ # improve pythonic api def __add__(self, other): assert isinstance(other, self.__class__) - return self.__class__(self[:] + other[:]) + return self._copy(self[:] + other[:]) def extend(self, other): """Extend with anoter PyQuery object""" @@ -294,7 +298,7 @@ else: elems = self for elem in elems: - yield self.__class__(elem, **dict(parent=self)) + yield self._copy(elem, parent=self) def xhtml_to_html(self): """Remove xhtml namespace: @@ -415,7 +419,7 @@ xpath = self._css_to_xpath(selector, 'self::') results = [] for tag in elements: - results.extend(tag.xpath(xpath)) + results.extend(tag.xpath(xpath, namespaces=self.namespaces)) if reverse: results.reverse() if unique: @@ -424,7 +428,7 @@ for item in result_list: if not item in results: results.append(item) - return self.__class__(results, **dict(parent=self)) + return self._copy(results, parent=self) def parent(self, selector=None): return self._filter_only( @@ -548,11 +552,11 @@ result = [] for current in self: while (current is not None and - not self.__class__(current).is_(selector)): + not self._copy(current).is_(selector)): current = current.getparent() if current is not None: result.append(current) - return self.__class__(result, **dict(parent=self)) + return self._copy(result, parent=self) def contents(self): """ @@ -564,8 +568,8 @@ """ results = [] for elem in self: - results.extend(elem.xpath('child::text()|child::*')) - return self.__class__(results, **dict(parent=self)) + results.extend(elem.xpath('child::text()|child::*', namespaces=self.namespaces)) + return self._copy(results, parent=self) def filter(self, selector): """Filter elements in self using selector (string or function): @@ -597,7 +601,7 @@ f_globals = func_globals(selector) if 'this' in f_globals: del f_globals['this'] - return self.__class__(elements, **dict(parent=self)) + return self._copy(elements, parent=self) def not_(self, selector): """Return elements that don't match the given selector: @@ -606,9 +610,9 @@ >>> d('p').not_('.hello') [<p>] """ - exclude = set(self.__class__(selector, self)) - return self.__class__([e for e in self if e not in exclude], - **dict(parent=self)) + exclude = set(self._copy(selector, self)) + return self._copy([e for e in self if e not in exclude], + parent=self) def is_(self, selector): """Returns True if selector matches at least one current element, else @@ -639,13 +643,13 @@ [<em>] """ xpath = self._css_to_xpath(selector) - results = [child.xpath(xpath) for tag in self + results = [child.xpath(xpath, namespaces=self.namespaces) for tag in self for child in tag.getchildren()] # Flatten the results elements = [] for r in results: elements.extend(r) - return self.__class__(elements, **dict(parent=self)) + return self._copy(elements, parent=self) def eq(self, index): """Return PyQuery of only the element with the provided index:: @@ -666,7 +670,7 @@ items = self[index] except IndexError: items = [] - return self.__class__(items, **dict(parent=self)) + return self._copy(items, parent=self) def each(self, func): """apply func on each nodes @@ -713,7 +717,7 @@ f_globals = func_globals(func) if 'this' in f_globals: del f_globals['this'] - return self.__class__(items, **dict(parent=self)) + return self._copy(items, parent=self) @property def length(self): @@ -1101,7 +1105,7 @@ root = fromstring(unicode('<root>') + value + unicode('</root>'), self.parser)[0] elif isinstance(value, etree._Element): - root = self.__class__(value) + root = self._copy(value) elif isinstance(value, PyQuery): root = value else: @@ -1318,13 +1322,13 @@ value = str(value) if hasattr(value, '__call__'): for i, element in enumerate(self): - self.__class__(element).before( + self._copy(element).before( value(i, element) + (element.tail or '')) parent = element.getparent() parent.remove(element) else: for tag in self: - self.__class__(tag).before(value + (tag.tail or '')) + self._copy(tag).before(value + (tag.tail or '')) parent = tag.getparent() parent.remove(tag) return self @@ -1378,7 +1382,7 @@ prev.tail += ' ' + tag.tail parent.remove(tag) else: - results = self.__class__(expr, self) + results = self._copy(expr, self) results.remove() return self diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.10/pyquery.egg-info/PKG-INFO new/pyquery-1.2.11/pyquery.egg-info/PKG-INFO --- old/pyquery-1.2.10/pyquery.egg-info/PKG-INFO 2016-01-05 13:50:45.000000000 +0100 +++ new/pyquery-1.2.11/pyquery.egg-info/PKG-INFO 2016-02-02 12:41:45.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyquery -Version: 1.2.10 +Version: 1.2.11 Summary: A jquery-like library for python Home-page: https://github.com/gawel/pyquery Author: Gael Pasgrimaud @@ -73,6 +73,13 @@ News ==== + 1.2.11 (2016-02-02) + ------------------- + + - Preserve namespaces attribute on PyQuery copies. + + - Do not raise an error when the http response code is 2XX + 1.2.10 (2016-01-05) ------------------- @@ -127,111 +134,110 @@ 1.2.6 (2013-10-11) ------------------ - README_fixt.py was not include in the release. Fix #54. + - README_fixt.py was not include in the release. Fix #54. 1.2.5 (2013-10-10) ------------------ - cssselect compat. See https://github.com/SimonSapin/cssselect/pull/22 + - cssselect compat. See https://github.com/SimonSapin/cssselect/pull/22 - tests improvments. no longer require a eth connection. + - tests improvments. no longer require a eth connection. - fix #55 + - fix #55 1.2.4 ----- - Moved to github. So a few files are renamed from .txt to .rst + - Moved to github. So a few files are renamed from .txt to .rst - Added .xhtml_to_html() and .remove_namespaces() + - Added .xhtml_to_html() and .remove_namespaces() - Use requests to fetch urls (if available) + - Use requests to fetch urls (if available) - Use restkit's proxy instead of Paste (which will die with py3) + - Use restkit's proxy instead of Paste (which will die with py3) - Allow to open https urls + - Allow to open https urls - python2.5 is no longer supported (may work, but tests are broken) + - python2.5 is no longer supported (may work, but tests are broken) 1.2.3 ----- - Allow to pass this in .filter() callback + - Allow to pass this in .filter() callback - Add .contents() .items() + - Add .contents() .items() - Add tox.ini + - Add tox.ini - Bug fixes: fix #35 #55 #64 #66 + - Bug fixes: fix #35 #55 #64 #66 1.2.2 ----- - Fix cssselectpatch to match the newer implementation of cssselect. Fixes issue #62, #52 and #59 (Haoyu Bai) + - Fix cssselectpatch to match the newer implementation of cssselect. Fixes issue #62, #52 and #59 (Haoyu Bai) - Fix issue #37 (Caleb Burns) + - Fix issue #37 (Caleb Burns) 1.2.1 ----- - Allow to use a custom css translator. + - Allow to use a custom css translator. - Fix issue 44: case problem with xml documents + - Fix issue 44: case problem with xml documents 1.2 --- - PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue - 43. + - PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. - Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` + - Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` 1.1.1 ----- - Minor release. Include test file so you can run tests from the tarball. + - Minor release. Include test file so you can run tests from the tarball. 1.1 --- - fix issues 30, 31, 32 - py3 improvements / webob 1.2+ support + - fix issues 30, 31, 32 - py3 improvements / webob 1.2+ support 1.0 --- - fix issues 24 + - fix issues 24 0.7 --- - Python 3 compatible + - Python 3 compatible - Add __unicode__ method + - Add __unicode__ method - Add root and encoding attribute + - Add root and encoding attribute - fix issues 19, 20, 22, 23 + - fix issues 19, 20, 22, 23 0.6.1 ------ - Move README.txt at package root + - Move README.txt at package root - Add CHANGES.txt and add it to long_description + - Add CHANGES.txt and add it to long_description 0.6 ---- - Added PyQuery.outerHtml + - Added PyQuery.outerHtml - Added PyQuery.fn + - Added PyQuery.fn - Added PyQuery.map + - Added PyQuery.map - Change PyQuery.each behavior to reflect jQuery api + - Change PyQuery.each behavior to reflect jQuery api diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.10/setup.py new/pyquery-1.2.11/setup.py --- old/pyquery-1.2.10/setup.py 2016-01-05 13:50:44.000000000 +0100 +++ new/pyquery-1.2.11/setup.py 2016-02-02 12:41:44.000000000 +0100 @@ -40,7 +40,7 @@ """ % read('README', 'CHANGES') -version = '1.2.10' +version = '1.2.11' setup(name='pyquery', version=version, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.10/tests/test_pyquery.py new/pyquery-1.2.11/tests/test_pyquery.py --- old/pyquery-1.2.10/tests/test_pyquery.py 2016-01-05 13:50:44.000000000 +0100 +++ new/pyquery-1.2.11/tests/test_pyquery.py 2016-02-02 12:41:44.000000000 +0100 @@ -467,6 +467,9 @@ <foo xmlns:bar="http://example.com/bar"> bar:blahWhat</bar:blah> <idiot>123</idiot> + <baz xmlns="http://example.com/baz" a="b"> + <subbaz/> + </baz> </foo>''' xhtml = ''' @@ -476,17 +479,19 @@ </body> </html>''' + namespaces = {'bar': 'http://example.com/bar', 'baz': 'http://example.com/baz'} + def test_selector(self): expected = 'What' d = pq(b(self.xml), parser='xml') val = d('bar|blah', - namespaces={'bar': 'http://example.com/bar'}).text() + namespaces=self.namespaces).text() self.assertEqual(repr(val), repr(expected)) def test_selector_with_xml(self): expected = 'What' d = pq('bar|blah', b(self.xml), parser='xml', - namespaces={'bar': 'http://example.com/bar'}) + namespaces=self.namespaces) val = d.text() self.assertEqual(repr(val), repr(expected)) @@ -516,6 +521,16 @@ val = d('blah').text() self.assertEqual(repr(val), repr(expected)) + def test_persistent_namespaces(self): + d = pq(b(self.xml), parser='xml', namespaces=self.namespaces) + val = d('bar|blah').text() + self.assertEqual(repr(val), repr('What')) + + def test_namespace_traversal(self): + d = pq(b(self.xml), parser='xml', namespaces=self.namespaces) + val = d('baz|subbaz').closest('baz|baz').attr('a') + self.assertEqual(repr(val), repr('b')) + class TestWebScrapping(TestCase):