#NEWLINE# def update_status( self , status ) : #NEWLINE# #INDENT# '\n        Update the Build status, both in database\n        and on github. If no token is found to update the build,\n        a MissingToken exception is raised.\n\n        :param status:              the status to update\n        ' #NEWLINE# token = self . repository . get_token ( ) #NEWLINE# if ( status not in ( 'success' , 'pending' , 'errored' , 'failure' ) ) : #NEWLINE# #INDENT# raise InvalidStatus ( 'Invalid status.' ) #NEWLINE# #UNINDENT# self . status = status #NEWLINE# self . save ( ) #NEWLINE# github . create_status ( token . value , self . repository . name , self . sha , state = status , target_url = self . url )