#NEWLINE# def __init__( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# super ( UpdateInstanceSecurityGroupsAction , self ) . __init__ ( request , * args , ** kwargs ) #NEWLINE# err_msg = _ ( 'Unable to retrieve security group list. Please try again later.' ) #NEWLINE# context = args [ 0 ] #NEWLINE# instance_id = context . get ( 'instance_id' , '' ) #NEWLINE# default_role_name = self . get_default_role_field_name ( ) #NEWLINE# self . fields [ default_role_name ] = forms . CharField ( required = False ) #NEWLINE# self . fields [ default_role_name ] . initial = 'member' #NEWLINE# all_groups = [ ] #NEWLINE# try : #NEWLINE# #INDENT# all_groups = api . network . security_group_list ( request ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# exceptions . handle ( request , err_msg ) #NEWLINE# #UNINDENT# groups_list = [ ( group . id , group . name ) for group in all_groups ] #NEWLINE# instance_groups = [ ] #NEWLINE# try : #NEWLINE# #INDENT# instance_groups = api . network . server_security_groups ( request , instance_id ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# exceptions . handle ( request , err_msg ) #NEWLINE# #UNINDENT# field_name = self . get_member_field_name ( 'member' ) #NEWLINE# self . fields [ field_name ] = forms . MultipleChoiceField ( required = False ) #NEWLINE# self . fields [ field_name ] . choices = groups_list #NEWLINE# self . fields [ field_name ] . initial = [ group . id for group in self ]