5.11: TypeErrors with QWebEngineCookieStore::setCookieFilter

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

5.11: TypeErrors with QWebEngineCookieStore::setCookieFilter

Florian Bruhin
Hey,

I've tried implementing a cookie filter with the Qt 5.11 snapshot
(sip-4.19.9.dev1806101717, PyQt5_gpl-5.11.dev1806101728, Qt 5.11.1
branch, GCC 8.1.1 on Archlinux).

When trying in my real application with a:

  store = QWebEngineProfile.defaultProfile().cookieStore()
  store.setCookieFilter(lambda _info: True)

I get:

  TypeError: a 'bool' is expected not 'generator'

I've tried to write a minimal example (attached), but that seems to work
fine. However, when I add the commented "print", I get:

  TypeError: 'managedbuffer' object is not callable

Not sure if that's the same issue, or two different issues?

Florian

--
https://www.qutebrowser.org | [hidden email] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

cookies.py (419 bytes) Download Attachment
signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 5.11: TypeErrors with QWebEngineCookieStore::setCookieFilter

Phil Thompson-5
On 11 Jun 2018, at 9:32 am, Florian Bruhin <[hidden email]> wrote:

>
> Hey,
>
> I've tried implementing a cookie filter with the Qt 5.11 snapshot
> (sip-4.19.9.dev1806101717, PyQt5_gpl-5.11.dev1806101728, Qt 5.11.1
> branch, GCC 8.1.1 on Archlinux).
>
> When trying in my real application with a:
>
>  store = QWebEngineProfile.defaultProfile().cookieStore()
>  store.setCookieFilter(lambda _info: True)
>
> I get:
>
>  TypeError: a 'bool' is expected not 'generator'
>
> I've tried to write a minimal example (attached), but that seems to work
> fine. However, when I add the commented "print", I get:
>
>  TypeError: 'managedbuffer' object is not callable
>
> Not sure if that's the same issue, or two different issues?

Should be fixed in tonight's snapshot.

Thanks,
Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: 5.11: TypeErrors with QWebEngineCookieStore::setCookieFilter

Florian Bruhin
On Mon, Jun 11, 2018 at 05:51:07PM +0100, Phil Thompson wrote:

> On 11 Jun 2018, at 9:32 am, Florian Bruhin <[hidden email]> wrote:
> >
> > Hey,
> >
> > I've tried implementing a cookie filter with the Qt 5.11 snapshot
> > (sip-4.19.9.dev1806101717, PyQt5_gpl-5.11.dev1806101728, Qt 5.11.1
> > branch, GCC 8.1.1 on Archlinux).
> >
> > When trying in my real application with a:
> >
> >  store = QWebEngineProfile.defaultProfile().cookieStore()
> >  store.setCookieFilter(lambda _info: True)
> >
> > I get:
> >
> >  TypeError: a 'bool' is expected not 'generator'
> >
> > I've tried to write a minimal example (attached), but that seems to work
> > fine. However, when I add the commented "print", I get:
> >
> >  TypeError: 'managedbuffer' object is not callable
> >
> > Not sure if that's the same issue, or two different issues?
>
> Should be fixed in tonight's snapshot.
Unfortunately it still seems to interact weirdly with other lambdas. In
my real code, I get:

  File ".../qutebrowser/browser/webengine/webenginetab.py", line 87, in <lambda>
    profile.clearVisitedLinks([url]))
TypeError: index 0 has type 'FilterRequest' but 'QUrl' is expected

The lambda looks like this and certainly always gets a QUrl:

  hist.url_cleared.connect(lambda url, profile=p: profile.clearVisitedLinks([url]))

I've also found another minimal example (attached), where I get this:

  TypeError: <lambda>() takes 0 positional arguments but 1 was given

Despite the two lambdas working fine on their own - it seems like the
QTimer lambda is invoked from the filter instead of the one I actually
passed.

Florian

--
https://www.qutebrowser.org | [hidden email] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

cookies.py (545 bytes) Download Attachment
signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 5.11: TypeErrors with QWebEngineCookieStore::setCookieFilter

Phil Thompson-5
On 12 Jun 2018, at 8:25 am, Florian Bruhin <[hidden email]> wrote:

>
> On Mon, Jun 11, 2018 at 05:51:07PM +0100, Phil Thompson wrote:
>> On 11 Jun 2018, at 9:32 am, Florian Bruhin <[hidden email]> wrote:
>>>
>>> Hey,
>>>
>>> I've tried implementing a cookie filter with the Qt 5.11 snapshot
>>> (sip-4.19.9.dev1806101717, PyQt5_gpl-5.11.dev1806101728, Qt 5.11.1
>>> branch, GCC 8.1.1 on Archlinux).
>>>
>>> When trying in my real application with a:
>>>
>>> store = QWebEngineProfile.defaultProfile().cookieStore()
>>> store.setCookieFilter(lambda _info: True)
>>>
>>> I get:
>>>
>>> TypeError: a 'bool' is expected not 'generator'
>>>
>>> I've tried to write a minimal example (attached), but that seems to work
>>> fine. However, when I add the commented "print", I get:
>>>
>>> TypeError: 'managedbuffer' object is not callable
>>>
>>> Not sure if that's the same issue, or two different issues?
>>
>> Should be fixed in tonight's snapshot.
>
> Unfortunately it still seems to interact weirdly with other lambdas. In
> my real code, I get:
>
>  File ".../qutebrowser/browser/webengine/webenginetab.py", line 87, in <lambda>
>    profile.clearVisitedLinks([url]))
> TypeError: index 0 has type 'FilterRequest' but 'QUrl' is expected
>
> The lambda looks like this and certainly always gets a QUrl:
>
>  hist.url_cleared.connect(lambda url, profile=p: profile.clearVisitedLinks([url]))
>
> I've also found another minimal example (attached), where I get this:
>
>  TypeError: <lambda>() takes 0 positional arguments but 1 was given
>
> Despite the two lambdas working fine on their own - it seems like the
> QTimer lambda is invoked from the filter instead of the one I actually
> passed.

I was hoping to avoid leaking a filter if you called setFilter() a second time, but it doesn't look like that's possible.

Try again tomorrow.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: 5.11: TypeErrors with QWebEngineCookieStore::setCookieFilter

Phil Thompson-5
On 12 Jun 2018, at 10:28 am, Phil Thompson <[hidden email]> wrote:

>
> On 12 Jun 2018, at 8:25 am, Florian Bruhin <[hidden email]> wrote:
>>
>> On Mon, Jun 11, 2018 at 05:51:07PM +0100, Phil Thompson wrote:
>>> On 11 Jun 2018, at 9:32 am, Florian Bruhin <[hidden email]> wrote:
>>>>
>>>> Hey,
>>>>
>>>> I've tried implementing a cookie filter with the Qt 5.11 snapshot
>>>> (sip-4.19.9.dev1806101717, PyQt5_gpl-5.11.dev1806101728, Qt 5.11.1
>>>> branch, GCC 8.1.1 on Archlinux).
>>>>
>>>> When trying in my real application with a:
>>>>
>>>> store = QWebEngineProfile.defaultProfile().cookieStore()
>>>> store.setCookieFilter(lambda _info: True)
>>>>
>>>> I get:
>>>>
>>>> TypeError: a 'bool' is expected not 'generator'
>>>>
>>>> I've tried to write a minimal example (attached), but that seems to work
>>>> fine. However, when I add the commented "print", I get:
>>>>
>>>> TypeError: 'managedbuffer' object is not callable
>>>>
>>>> Not sure if that's the same issue, or two different issues?
>>>
>>> Should be fixed in tonight's snapshot.
>>
>> Unfortunately it still seems to interact weirdly with other lambdas. In
>> my real code, I get:
>>
>> File ".../qutebrowser/browser/webengine/webenginetab.py", line 87, in <lambda>
>>   profile.clearVisitedLinks([url]))
>> TypeError: index 0 has type 'FilterRequest' but 'QUrl' is expected
>>
>> The lambda looks like this and certainly always gets a QUrl:
>>
>> hist.url_cleared.connect(lambda url, profile=p: profile.clearVisitedLinks([url]))
>>
>> I've also found another minimal example (attached), where I get this:
>>
>> TypeError: <lambda>() takes 0 positional arguments but 1 was given
>>
>> Despite the two lambdas working fine on their own - it seems like the
>> QTimer lambda is invoked from the filter instead of the one I actually
>> passed.
>
> I was hoping to avoid leaking a filter if you called setFilter() a second time, but it doesn't look like that's possible.

I think I've worked out how to do it. You will need tonight's SIP snapshot as well.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: 5.11: TypeErrors with QWebEngineCookieStore::setCookieFilter

Florian Bruhin
On Tue, Jun 12, 2018 at 02:39:14PM +0100, Phil Thompson wrote:
> > I was hoping to avoid leaking a filter if you called setFilter() a second time, but it doesn't look like that's possible.
>
> I think I've worked out how to do it. You will need tonight's SIP snapshot as well.

Seems to work fine now - thanks! :)

Florian

--
https://www.qutebrowser.org | [hidden email] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

signature.asc (849 bytes) Download Attachment