#NEWLINE# def __init__( self , modelXbrl , user , password , host , port , database , timeout ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# initRdflibNamespaces ( ) #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# raise XRDBException ( 'xrdfDB:MissingRdflib' , _ ( 'Rdflib is not installed or is not available in this build' ) ) #NEWLINE# #UNINDENT# self . modelXbrl = modelXbrl #NEWLINE# self . disclosureSystem = modelXbrl . modelManager . disclosureSystem #NEWLINE# self . isRdfTurtleFile = ( host == RDFTURTLEFILE_HOSTNAME ) #NEWLINE# self . isRdfXmlFile = ( host == RDFXMLFILE_HOSTNAME ) #NEWLINE# if ( self . isRdfTurtleFile or self . isRdfXmlFile ) : #NEWLINE# #INDENT# self . turtleFile = database #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# connectionUrl = 'http://{0}:{1}' . format ( host , ( port or '80' ) ) #NEWLINE# self . url = connectionUrl #NEWLINE# if database : #NEWLINE# #INDENT# self . url += ( '/' + database ) #NEWLINE# #UNINDENT# auth_handler = urllib . request . HTTPBasicAuthHandler ( ) #NEWLINE# if user : #NEWLINE# #INDENT# auth_handler . add_password ( realm = None , uri = connectionUrl , user = user , passwd = password ) #NEWLINE# #UNINDENT# self . conn = urllib . request . build_opener ( self ) #NEWLINE# self . timeout = ( timeout or 60 ) #NEWLINE# #UNINDENT# self . verticePropTypes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# }