#NEWLINE# def handle( self , request , data ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# data [ 'public_key' ] = NEW_LINES . sub ( '' , self [ 'public_key' ] ) #NEWLINE# keypair = api . nova . keypair_import ( request , data [ 'name' ] , data [ 'public_key' ] ) #NEWLINE# messages . success ( request , ( _ ( 'Successfully imported public key: %s' ) % data [ 'name' ] ) ) #NEWLINE# return keypair #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# exceptions . handle ( request , ignore = True ) #NEWLINE# self . api_error ( _ ( 'Unable to import key pair.' ) ) #NEWLINE# return False