[PySide] QtNetwork.QSslSocket.supportsSsl()

Roman Lacko backup.rlacko at gmail.com
Wed Oct 8 23:58:40 CEST 2014


2014-10-08 23:41 GMT+02:00 Roman Lacko <backup.rlacko at gmail.com>:

> 2014-10-08 22:56 GMT+02:00 Joel B. Mohler <JMohler at gamry.com>:
>
>> On 10/8/2014 3:16 PM, Roman Lacko wrote:
>> > What about adding some environment variable check, PYSIDE_INIT_OPENSSL:
>>
>> This went through my mind too so I'm glad to hear a vote in this
>> direction from somebody else.  I also agree with the semantics of your
>> boolean -- you should have to explicitly set this to have this code
>> run.  My rationale for this is that I tend to view my work as Python
>> first and would use Python libraries for my networking rather than
>> PySide if possible.
>>
>
> I just realized that for backward compatibility it would be better to
> leave the actual behavior and let users to explicitly disable loading the
> openssl libs. But this is subject to further discussion...
>

the sample implementation can look like this:

    if sys.platform == 'win32':
        ignoreOpenSsl = os.environ['PYSIDE_IGNORE_
OPENSSL']
        opensslDir = os.path.join(pysideDir, 'openssl')
        if not ignoreOpenSsl and os.path.exists(opensslDir):
            path = os.environ['PATH']
            ...


>
>
>
>>
>> If I don't hear any ideas to the contrary, I'll probably put this in a
>> patch in the next day or so.
>>
>> >
>> >     # On Windows add the PySide\openssl folder (if it exists) to the
>> >     # PATH so the SSL DLLs can be found when Qt tries to dynamically
>> >     # load them.  Tell Qt to load them and then reset the PATH.
>> >     if sys.platform == 'win32':
>> >         initOpenSsl = os.environ['PYSIDE_INIT_OPENSSL']
>> >         opensslDir = os.path.join(pysideDir, 'openssl')
>> >         if initOpenSsl and os.path.exists(opensslDir):
>> >             path = os.environ['PATH']
>> >             try:
>> >                 os.environ['PATH'] = opensslDir + os.pathsep + path
>> >                 try:
>> >                     from . import QtNetwork
>> >                 except ImportError:
>> >                     pass
>> >                 else:
>> >                     QtNetwork.QSslSocket.supportsSsl()
>> >             finally:
>> >                 os.environ['PATH'] = path
>>
>>
>> _______________________________________________
>> PySide mailing list
>> PySide at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/pyside
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20141008/47adbb2b/attachment.html>


More information about the PySide mailing list