<s> import logging <EOL> from django . core . urlresolvers import reverse <EOL> 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> LOG = logging . getLogger ( __name__ ) <EOL> class UpdateNetwork ( forms . SelfHandlingForm ) : <EOL> name = forms . CharField ( label = _ ( "<STR_LIT:Name>" ) , required = False ) <EOL> tenant_id = forms . CharField ( widget = forms . HiddenInput ) <EOL> network_id = forms . CharField ( label = _ ( "<STR_LIT>" ) , <EOL> widget = forms . TextInput ( <EOL> attrs = { '<STR_LIT>' : '<STR_LIT>' } ) ) <EOL> admin_state = forms . BooleanField ( label = _ ( "<STR_LIT>" ) , required = False ) <EOL> failure_url = '<STR_LIT>' <EOL> def handle ( self , request , data ) : <EOL> try : <EOL> params = { '<STR_LIT>' : data [ '<STR_LIT>' ] , <EOL> '<STR_LIT:name>' : data [ '<STR_LIT:name>' ] } <EOL> network = api . neutron . network_modify ( request , data [ '<STR_LIT>' ] , <EOL> ** params ) <EOL> msg = _ ( '<STR_LIT>' ) % data [ '<STR_LIT:name>' ] <EOL> LOG . debug ( msg ) <EOL> messages . success ( request , msg ) <EOL> return network <EOL> except Exception : <EOL> msg = _ ( '<STR_LIT>' ) % data [ '<STR_LIT:name>' ] <EOL> LOG . info ( msg ) <EOL> redirect = reverse ( self . failure_url ) <EOL> exceptions . handle ( request , msg , redirect = redirect ) </s>
