<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 RegisterIdPForm ( forms . SelfHandlingForm ) : <EOL> id = forms . CharField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> max_length = <NUM_LIT:64> , <EOL> help_text = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> remote_ids = forms . CharField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> required = False , <EOL> help_text = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> description = forms . CharField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> widget = forms . widgets . Textarea ( attrs = { '<STR_LIT>' : <NUM_LIT:4> } ) , <EOL> required = False ) <EOL> enabled = forms . BooleanField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> required = False , <EOL> help_text = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> initial = True ) <EOL> def handle ( self , request , data ) : <EOL> try : <EOL> remote_ids = data [ "<STR_LIT>" ] or [ ] <EOL> if remote_ids : <EOL> remote_ids = [ rid . strip ( ) for rid in remote_ids . split ( '<STR_LIT:U+002C>' ) ] <EOL> new_idp = api . keystone . identity_provider_create ( <EOL> request , <EOL> data [ "<STR_LIT:id>" ] , <EOL> description = data [ "<STR_LIT:description>" ] , <EOL> enabled = data [ "<STR_LIT>" ] , <EOL> remote_ids = remote_ids ) <EOL> messages . success ( request , <EOL> _ ( "<STR_LIT>" ) ) <EOL> return new_idp <EOL> except exceptions . Conflict : <EOL> msg = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> messages . error ( request , msg ) <EOL> except Exception : <EOL> exceptions . handle ( request , <EOL> _ ( "<STR_LIT>" ) ) <EOL> return False <EOL> class UpdateIdPForm ( forms . SelfHandlingForm ) : <EOL> id = forms . CharField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> widget = forms . TextInput ( attrs = { '<STR_LIT>' : '<STR_LIT>' } ) , <EOL> help_text = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> remote_ids = forms . CharField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> required = False , <EOL> help_text = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> description = forms . CharField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> widget = forms . widgets . Textarea ( attrs = { '<STR_LIT>' : <NUM_LIT:4> } ) , <EOL> required = False ) <EOL> enabled = forms . BooleanField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> required = False , <EOL> help_text = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> initial = True ) <EOL> def handle ( self , request , data ) : <EOL> try : <EOL> remote_ids = data [ "<STR_LIT>" ] or [ ] <EOL> if remote_ids : <EOL> remote_ids = [ rid . strip ( ) for rid in remote_ids . split ( '<STR_LIT:U+002C>' ) ] <EOL> api . keystone . identity_provider_update ( <EOL> request , <EOL> data [ '<STR_LIT:id>' ] , <EOL> description = data [ "<STR_LIT:description>" ] , <EOL> enabled = data [ "<STR_LIT>" ] , <EOL> remote_ids = remote_ids ) <EOL> messages . success ( request , <EOL> _ ( "<STR_LIT>" ) ) <EOL> return True <EOL> except exceptions . Conflict : <EOL> msg = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> messages . error ( request , msg ) <EOL> except Exception : <EOL> exceptions . handle ( request , <EOL> _ ( '<STR_LIT>' ) ) <EOL> return False </s>
