[PyQt] Issue of QWebPage.extension

Flya Flyaa flyaflyaa at gmail.com
Mon Jan 7 13:55:27 GMT 2013


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130107/b9f2d3e0/attachment.html>


More information about the PyQt mailing list