[PyQt] Issue of QWebPage.extension

Phil Thompson phil at riverbankcomputing.com
Tue Jan 8 14:40:49 GMT 2013


On Mon, 7 Jan 2013 21:55:27 +0800, Flya Flyaa <flyaflyaa at gmail.com> wrote:
> I want to get page detailed error message this way:
>
http://stackoverflow.com/questions/7279046/how-to-get-detailed-error-message-when-qtwebkit-fails-to-load-a-page
> 
> This need  reimplement  QWebPage.extension
>
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebpage.html#extension,
> and get detail from the second argument ExtensionOption.
> 
> Code like this:
> 
>     def extension(self, extension, info = None, errorPage = None):
>         if extension == QtWebKit.QWebPage.ErrorPageExtension:
>             content = u"<html><head><title>Failed loading
> page</title></head><body><h1>Failed loading page (%s)</h1><h2>%s</h2>
> </body></html>" % (info.errorString, info.url.toString())
>             errorPage.content =
QtCore.QByteArray(content.encode('utf-8'))
>             gdata.log(u'Warn: Failed loading [%s] (%s)!' %
> (info.errorString, info.url.toString() ))
>             return True
>         return True
> 
> When extension == QtWebKit.QWebPage.ErrorPageExtension, the second
argument
> should be QWebPage.ErrorPageExtensionOption, but it always
> be QWebPage.ExtensionOption, and can't get the detailed error message
from
> it.
> 
> PySide has this problem in earlier versions, it be fixed later with test
> case
>
http://pyside.sourcearchive.com/documentation/1.0.1-1/bug__694_8py_source.html.
> Hope PyQt can fix it.

Should be fixed in tonight's snapshot (but untested).

Phil


More information about the PyQt mailing list