Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter() doesn't accept other PyQuery objects. #232

Open
username27 opened this issue Apr 28, 2022 · 0 comments
Open

filter() doesn't accept other PyQuery objects. #232

username27 opened this issue Apr 28, 2022 · 0 comments

Comments

@username27
Copy link

Consider the following:
jsfiddle

code:

a = $("div")
b = $('[page="2"]')
a.filter(b).css("color", "red")

As you can see, filter accepts another jquery object.

PyQuery however throws the following exception:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyquery\pyquery.py in filter(self, selector)
    580                     if len(args) == 1:
--> 581                         selector.__globals__['this'] = this
    582                     if callback(selector, i, this):

AttributeError: 'PyQuery' object has no attribute '__globals__'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-7-36cbb5d34989> in <module>
     24 print(a.text())
     25 print(b.text())
---> 26 print(a.filter(b).text())

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyquery\pyquery.py in filter(self, selector)
    583                         elements.append(this)
    584             finally:
--> 585                 f_globals = selector.__globals__
    586                 if 'this' in f_globals:
    587                     del f_globals['this']

AttributeError: 'PyQuery' object has no attribute '__globals__'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant