#NEWLINE# def returner( ret ) : #NEWLINE# #INDENT# '\n    Take in the return and shove it into the couchdb database.\n    ' #NEWLINE# options = _get_options ( ret ) #NEWLINE# _response = _request ( 'GET' , ( options [ 'url' ] + '_all_dbs' ) ) #NEWLINE# if ( options [ 'db' ] not in _response ) : #NEWLINE# #INDENT# _response = _request ( 'PUT' , ( options [ 'url' ] + options [ 'db' ] ) ) #NEWLINE# if ( ( 'ok' not in _response ) or ( options [ 'ok' ] is not True ) ) : #NEWLINE# #INDENT# log . error ( 'Unable to create database "{0}"' . format ( options [ 'db' ] ) ) #NEWLINE# log . error ( 'Nothing logged! Lost data.' ) #NEWLINE# return #NEWLINE# #UNINDENT# log . info ( 'Created database "{0}"' . format ( options [ 'db' ] ) ) #NEWLINE# #UNINDENT# doc = _generate_doc ( ret ) #NEWLINE# _response = _request ( 'PUT' , ( ( ( options [ 'url' ] + options [ 'db' ] ) + '/' ) + doc [ '_id' ] ) , 'application/json' , json . dumps ( doc ) ) #NEWLINE# if ( ( 'ok' not in _response ) or ( _response [ 'ok' ] is not True ) ) : #NEWLINE# #INDENT# log . error ( 'Unable to create document: "{0}"' . format ( _response ) ) #NEWLINE# log . error ( 'Nothing logged! Lost data.' )