<s> """<STR_LIT>""" <EOL> 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 CreateForm ( forms . SelfHandlingForm ) : <EOL> name = forms . CharField ( max_length = "<STR_LIT>" , label = _ ( "<STR_LIT>" ) ) <EOL> failure_url = '<STR_LIT>' <EOL> def __init__ ( self , request , * args , ** kwargs ) : <EOL> super ( CreateForm , self ) . __init__ ( request , * args , ** kwargs ) <EOL> def handle ( self , request , data ) : <EOL> try : <EOL> router = api . neutron . router_create ( request , <EOL> name = data [ '<STR_LIT:name>' ] ) <EOL> message = _ ( '<STR_LIT>' ) % data [ '<STR_LIT:name>' ] <EOL> messages . success ( request , message ) <EOL> return router <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 ) <EOL> return False </s>
