#NEWLINE# def _validate_alias( request , form , successmsg , callback = None ) : #NEWLINE# #INDENT# 'Alias validation\n\n    Common function shared between creation and modification actions.\n    ' #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# alias = form . save ( ) #NEWLINE# #UNINDENT# except IntegrityError : #NEWLINE# #INDENT# raise Conflict ( _ ( 'Alias with this name already exists' ) ) #NEWLINE# #UNINDENT# if callback : #NEWLINE# #INDENT# callback ( form . user , alias ) #NEWLINE# #UNINDENT# return render_to_json_response ( successmsg ) #NEWLINE# #UNINDENT# return render_to_json_response ( { #NEWLINE# #INDENT# 'form_errors' : form . errors , #NEWLINE# #UNINDENT# } , status = 400 )