#NEWLINE# def __init__( self , datastore_name = None , config = None , scope = None , profile = None , **kwargs ) : #NEWLINE# #INDENT# super ( CouchDataStore , self ) . __init__ ( datastore_name = config , config = config , scope = scope , profile = profile ) #NEWLINE# if ( self . config . get ( 'type' , None ) and ( self . config [ 'type' ] != 'couchdb' ) ) : #NEWLINE# #INDENT# raise BadRequest ( ( 'Datastore server config is not couchdb: %s' % self . config ) ) #NEWLINE# #UNINDENT# if ( self . datastore_name and ( self . datastore_name != self . datastore_name . lower ( ) ) ) : #NEWLINE# #INDENT# raise BadRequest ( ( "Invalid CouchDB datastore name: '%s'" % self . datastore_name ) ) #NEWLINE# #UNINDENT# if ( self . scope and ( self . scope != self . scope . lower ( ) ) ) : #NEWLINE# #INDENT# raise BadRequest ( ( "Invalid CouchDB scope name: '%s'" % self . scope ) ) #NEWLINE# #UNINDENT# if ( self . username and self . password ) : #NEWLINE# #INDENT# connection_str = ( 'http://%s:%s@%s:%s' % ( self . username , self . password , self . host , self . port ) ) #NEWLINE# log_connection_str = ( 'http://%s:%s@%s:%s' % ( 'username' , 'password' , self . host , self . port ) ) #NEWLINE# log . debug ( 'Using username:password authentication to connect to datastore' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# connection_str = ( 'http://%s:%s' % ( self . host , self . port ) ) #NEWLINE# log_connection_str = connection_str #NEWLINE# #UNINDENT# log . info ( 'Connecting to CouchDB server: %s' , log_connection_str ) #NEWLINE# self . server = couchdb . Server ( connection_str ) #NEWLINE# self . _id_factory = None #NEWLINE# if self . datastore_name : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( ds , _ ) = self . _get_datastore ( ) #NEWLINE# #UNINDENT# except NotFound : #NEWLINE# #INDENT# self . create_datastore ( ) #NEWLINE# ( ds , _ ) = self . _get_datastore ( )