#NEWLINE# def create( self ) : #NEWLINE# #INDENT# data = self . validator . parse_post ( [ 'content' ] , [ 'identifier' , 'index' , 'indexes' , 'metadata' ] ) #NEWLINE# indexes = self . validator . validate_indexes ( data ) #NEWLINE# if ( indexes is None ) : #NEWLINE# #INDENT# error ( 'You must specify either an "index" or "indexes".' ) #NEWLINE# #UNINDENT# document = Document . create ( content = data [ 'content' ] , identifier = data . get ( 'identifier' ) ) #NEWLINE# if data . get ( 'metadata' ) : #NEWLINE# #INDENT# document . metadata = data [ 'metadata' ] #NEWLINE# #UNINDENT# for index in indexes : #NEWLINE# #INDENT# index . add_to_index ( document ) #NEWLINE# #UNINDENT# if len ( request . files ) : #NEWLINE# #INDENT# self . attach_files ( document ) #NEWLINE# #UNINDENT# return self . detail ( document . get_id ( ) )