#NEWLINE# def obj_create( self , bundle , request = None , **kwargs ) : #NEWLINE# #INDENT# '\n        Manually create the proper results objects.\n\n        This is necessary because we have special handler methods in\n        RunCaseVersion for setting the statuses which we want to keep DRY.\n\n        ' #NEWLINE# request = ( request or bundle . request ) #NEWLINE# data = bundle . data . copy ( ) #NEWLINE# try : #NEWLINE# #INDENT# status = data . pop ( 'status' ) #NEWLINE# case = data . pop ( 'case' ) #NEWLINE# env = Environment . objects . get ( pk = data . get ( 'environment' ) ) #NEWLINE# run = data . pop ( 'run_id' ) #NEWLINE# #UNINDENT# except KeyError as e : #NEWLINE# #INDENT# raise ValidationError ( 'bad result object data missing key: {0}' . format ( e ) ) #NEWLINE# #UNINDENT# except Environment . DoesNotExist as e : #NEWLINE# #INDENT# raise ValidationError ( 'Specified environment does not exist: {0}' . format ( e ) ) #NEWLINE# #UNINDENT# data [ 'environment' ] = request #NEWLINE# try : #NEWLINE# #INDENT# rcv = RunCaseVersion . objects . get ( run__id = run , caseversion__case__id = case , environments = env ) #NEWLINE# #UNINDENT# except RunCaseVersion . DoesNotExist as e : #NEWLINE# #INDENT# raise ValidationError ( 'RunCaseVersion not found for run: {0}, case: {1}, environment: {2}:\nError {3}' . format ( str ( run ) , str ( case ) , str ( env ) , e ) ) #NEWLINE# #UNINDENT# self . authorized_create_detail ( [ rcv ] , bundle ) #NEWLINE# data [ 'user' ] = request . user #NEWLINE# method = rcv . get_result_method ( status ) #NEWLINE# bundle . obj = method ( ** data ) #NEWLINE# return bundle