def getConfigOptions(self): '''Pass up getConfigOptions call''' #system, read from env/reg proxyconfigoptions = [] #(type, host, port, auth, usr, pwd) = self.PP type2 = LDSUtilities.assessNone(self.PP['TYPE']) if type2 == self.PROXY_TYPE[1]: if LDSUtilities.assessNone(self.PP['HOST']): hp = 'GDAL_HTTP_PROXY=' + str(self.PP['HOST']) if LDSUtilities.assessNone(self.PP['PORT']): hp += ':' + str(self.PP['PORT']) proxyconfigoptions += [hp] #if no h/p no point doing u/p proxyconfigoptions += ['GDAL_HTTP_PROXYUSERPWD= : '] if type2 == self.PROXY_TYPE[2]: #user difined, expect all fields filled if LDSUtilities.assessNone(self.PP['HOST']): hp = 'GDAL_HTTP_PROXY=' + str(self.PP['HOST']) if LDSUtilities.assessNone(self.PP['PORT']): hp += ':' + str(self.PP['PORT']) proxyconfigoptions += [hp] if LDSUtilities.assessNone(self.PP['USR']): up = 'GDAL_HTTP_PROXYUSERPWD=' + str(self.PP['USR']) if LDSUtilities.assessNone(self.PP['PWD']): if self.PP['PWD'].startswith(Encrypt.ENC_PREFIX): up += ":" + str(Encrypt.unSecure(self.PP['PWD'])) else: up += ":" + str(self.PP['PWD']) proxyconfigoptions += [up] #NB do we also need to set GDAL_HTTP_USERPWD? if LDSUtilities.assessNone(self.PP['AUTH']): proxyconfigoptions += [ 'GDAL_PROXY_AUTH=' + str(self.PP['AUTH']) ] #NB do we also need to set GDAL_HTTP_AUTH? return super(WFSDataStore, self).getConfigOptions() + proxyconfigoptions
def _commonURI(self,layer): '''Refers to common connection instance for reading or writing''' if hasattr(self,'conn_str') and self.conn_str: return self.validateConnStr(self.conn_str) #can't put schema in quotes, causes error but without quotes tables get created in public anyway, still need schema.table syntax if LDSUtilities.assessNone(self.pwd): if self.pwd.startswith(Encrypt.ENC_PREFIX): pwd = " password='******'".format(Encrypt.unSecure(self.pwd)) else: pwd = " password='******'".format(self.pwd) else: pwd = "" sch = " active_schema={}".format(self.schema) if LDSUtilities.assessNone(self.schema) else "" usr = "******".format(self.usr) if LDSUtilities.assessNone(self.usr) else "" hst = " host='{}'".format(self.host) if LDSUtilities.assessNone(self.host) else "" prt = " port='{}'".format(self.port) if LDSUtilities.assessNone(self.port) else "" uri = "PG:dbname='{}'".format(self.dbname)+hst+prt+usr+pwd+sch ldslog.debug(uri) return uri
def _commonURI(self,layer): '''Refers to common connection instance for example in a DB where it doesn't matter whether your reading or writing''' if hasattr(self,'conn_str') and self.conn_str: return self.validateConnStr(self.conn_str) #return "MSSQL:server={};database={};trusted_connection={};".format(self.server, self.dbname, self.trust) if LU.assessNone(self.pwd): if self.pwd.startswith(Encrypt.ENC_PREFIX): pwd = ";PWD={}".format(Encrypt.unSecure(self.pwd)) else: pwd = ";PWD={}".format(self.pwd) else: pwd = "" sstr = ";Schema={}".format(self.schema) if LU.assessNone(self.schema) else "" usr = "******".format(self.usr) if LU.assessNone(self.usr) else "" drv = ";Driver='{}'".format(self.odbc) if LU.assessNone(self.odbc) else "" tcn = ";trusted_connection={}".format(self.trust) if LU.assessNone(self.trust) else "" uri = "MSSQL:server={};database={}".format(self.server, self.dbname, self.odbc)+usr+pwd+drv+sstr+tcn ldslog.debug(uri) return uri
def getConfigOptions(self): '''Pass up getConfigOptions call''' #system, read from env/reg proxyconfigoptions = [] #(type, host, port, auth, usr, pwd) = self.PP type2 = LDSUtilities.assessNone(self.PP['TYPE']) if type2 == self.PROXY_TYPE[1]: if LDSUtilities.assessNone(self.PP['HOST']): hp = 'GDAL_HTTP_PROXY='+str(self.PP['HOST']) if LDSUtilities.assessNone(self.PP['PORT']): hp += ':'+str(self.PP['PORT']) proxyconfigoptions += [hp] #if no h/p no point doing u/p proxyconfigoptions += ['GDAL_HTTP_PROXYUSERPWD= : '] if type2 == self.PROXY_TYPE[2]: #user difined, expect all fields filled if LDSUtilities.assessNone(self.PP['HOST']): hp = 'GDAL_HTTP_PROXY='+str(self.PP['HOST']) if LDSUtilities.assessNone(self.PP['PORT']): hp += ':'+str(self.PP['PORT']) proxyconfigoptions += [hp] if LDSUtilities.assessNone(self.PP['USR']): up = 'GDAL_HTTP_PROXYUSERPWD='+str(self.PP['USR']) if LDSUtilities.assessNone(self.PP['PWD']): if self.PP['PWD'].startswith(Encrypt.ENC_PREFIX): up += ":"+str(Encrypt.unSecure(self.PP['PWD'])) else: up += ":"+str(self.PP['PWD']) proxyconfigoptions += [up] #NB do we also need to set GDAL_HTTP_USERPWD? if LDSUtilities.assessNone(self.PP['AUTH']): proxyconfigoptions += ['GDAL_PROXY_AUTH='+str(self.PP['AUTH'])] #NB do we also need to set GDAL_HTTP_AUTH? return super(WFSDataStore,self).getConfigOptions()+proxyconfigoptions