#NEWLINE# @ app . route ( '/debug/<project>' , methods = [ 'GET' , 'POST' ] ) #NEWLINE# def debug( project ) : #NEWLINE# #INDENT# projectdb = app . config [ 'projectdb' ] #NEWLINE# if ( not projectdb . verify_project_name ( project ) ) : #NEWLINE# #INDENT# return ( 'project name is not allowed!' , 400 ) #NEWLINE# #UNINDENT# info = projectdb . get ( project , fields = [ 'name' , 'script' ] ) #NEWLINE# if info : #NEWLINE# #INDENT# script = info [ 'script' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# script = default_script . replace ( '__DATE__' , datetime . datetime . now ( ) . strftime ( '%Y-%m-%d %H:%M:%S' ) ) . replace ( '__PROJECT_NAME__' , project ) . replace ( '__START_URL__' , ( request . values . get ( 'start-urls' ) or '__START_URL__' ) ) #NEWLINE# #UNINDENT# taskid = request . args . get ( 'taskid' ) #NEWLINE# if taskid : #NEWLINE# #INDENT# taskdb = app . config [ 'taskdb' ] #NEWLINE# task = taskdb . get_task ( project , taskid , [ 'taskid' , 'project' , 'url' , 'fetch' , 'process' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# task = default_task #NEWLINE# #UNINDENT# default_task [ 'project' ] = project #NEWLINE# return render_template ( 'debug.html' , task = task , script = script , project_name = project )