#NEWLINE# def add_video_from_post( form ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# name = form . get ( 'name' , '' ) . strip ( ) #NEWLINE# url = form . get ( 'url' , '' ) . strip ( ) #NEWLINE# duration = form . get ( 'duration' , '' ) . strip ( ) #NEWLINE# if ( ( len ( name ) < 1 ) or ( len ( form ) < 10 ) or ( len ( duration ) < 1 ) or ( int ( duration ) <= 0 ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Input validation failed' ) #NEWLINE# #UNINDENT# v = Video ( name , url , duration ) #NEWLINE# with video_lock : #NEWLINE# #INDENT# video_list . append ( v ) #NEWLINE# #UNINDENT# #UNINDENT# except ValueError : #NEWLINE# #INDENT# abort ( 400 )