#NEWLINE# def setupTLSContext( vc ) : #NEWLINE# #INDENT# if vc [ config . TLS ] : #NEWLINE# #INDENT# from opennsa import ctxfactory #NEWLINE# ctx_factory = ctxfactory . ContextFactory ( vc [ config . KEY ] , vc [ config . CERTIFICATE ] , vc [ config . CERTIFICATE_DIR ] , vc [ config . VERIFY_CERT ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if os . path . isdir ( vc [ config . CERTIFICATE_DIR ] ) : #NEWLINE# #INDENT# from opennsa import ctxfactory #NEWLINE# ctx_factory = ctxfactory . RequestContextFactory ( vc [ config . CERTIFICATE_DIR ] , vc [ config . VERIFY_CERT ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ctx_factory = None #NEWLINE# #UNINDENT# #UNINDENT# return ctx_factory