<s> from django . utils . translation import ugettext_lazy as _ <EOL> from horizon import exceptions <EOL> from horizon import forms <EOL> from horizon import messages <EOL> from openstack_dashboard import api <EOL> class CreateRoleForm ( forms . SelfHandlingForm ) : <EOL> name = forms . CharField ( label = _ ( "<STR_LIT>" ) ) <EOL> def handle ( self , request , data ) : <EOL> try : <EOL> new_user = api . keystone . role_create ( request , data [ "<STR_LIT:name>" ] ) <EOL> messages . success ( request , _ ( "<STR_LIT>" ) ) <EOL> return new_user <EOL> except Exception : <EOL> exceptions . handle ( request , _ ( '<STR_LIT>' ) ) <EOL> class UpdateRoleForm ( forms . SelfHandlingForm ) : <EOL> id = forms . CharField ( label = _ ( "<STR_LIT>" ) , widget = forms . HiddenInput ) <EOL> name = forms . CharField ( label = _ ( "<STR_LIT>" ) ) <EOL> def handle ( self , request , data ) : <EOL> try : <EOL> api . keystone . role_update ( request , data [ '<STR_LIT:id>' ] , data [ "<STR_LIT:name>" ] ) <EOL> messages . success ( request , _ ( "<STR_LIT>" ) ) <EOL> return True <EOL> except Exception : <EOL> exceptions . handle ( request , _ ( '<STR_LIT>' ) ) </s>
