broad (small) changes to make style of all routes and jobs to be consistent, e.g. use underscords between words

This commit is contained in:
2023-01-15 23:17:59 +11:00
parent dc11a0697b
commit 4b1bbcb2bf
16 changed files with 88 additions and 86 deletions

View File

@@ -320,7 +320,7 @@ def SetOrderStrings( OPT ):
################################################################################
# /GetEntries -> helper function that Gets Entries for required files to show
# for several routes (files_ip, files_sp, files_rbp, search, viewlist)
# for several routes (files_ip, files_sp, files_rbp, search, view_list)
################################################################################
def GetEntries( OPT ):
entries=[]
@@ -367,9 +367,9 @@ def GetEntries( OPT ):
UpdatePref( pref, OPT )
return entries
@app.route("/ChangeFileOpts", methods=["POST"])
@app.route("/change_file_opts", methods=["POST"])
@login_required
def ChangeFileOpts():
def change_file_opts():
# reset options based on form post, then redirect back to orig page (with a GET to allow back button to work)
OPT=States( request )
return redirect( request.referrer )
@@ -462,12 +462,12 @@ def scan_ip():
return redirect("/jobs")
################################################################################
# /files/forcescan -> deletes old data in DB, and does a brand new scan
# /files/force_scan -> deletes old data in DB, and does a brand new scan
################################################################################
@app.route("/files/forcescan", methods=["GET"])
@app.route("/files/force_scan", methods=["GET"])
@login_required
def forcescan():
job=NewJob( name="forcescan", num_files=0, wait_for=None, jex=None, desc="remove data and rescan import & storage paths" )
def force_scan():
job=NewJob( name="force_scan", num_files=0, wait_for=None, jex=None, desc="remove data and rescan import & storage paths" )
return redirect("/jobs")
################################################################################
@@ -497,7 +497,7 @@ def fix_dups():
if 'pagesize' not in request.form:
# default to 10, see if we have a larger value as someone reset it in the gui, rather than first time invoked
pagesize = 10
jexes = JobExtra.query.join(Job).filter(Job.name=='checkdups').filter(Job.pa_job_state=='New').all()
jexes = JobExtra.query.join(Job).filter(Job.name=='check_dups').filter(Job.pa_job_state=='New').all()
jexes.append( JobExtra( name="pagesize", value=pagesize ) )
else:
pagesize=int(request.form['pagesize'])
@@ -533,7 +533,7 @@ def rm_dups():
jex.append( JobExtra( name="pagesize", value=10 ) )
job=NewJob( name="rmdups", num_files=0, wait_for=None, jex=jex, desc="to delete duplicate files" )
job=NewJob( name="rm_dups", num_files=0, wait_for=None, jex=jex, desc="to delete duplicate files" )
return redirect("/jobs")
@@ -578,8 +578,8 @@ def move_files():
return make_response( jsonify( job_id=job.id ) )
@login_required
@app.route("/viewlist", methods=["POST"])
def viewlist():
@app.route("/view_list", methods=["POST"])
def view_list():
OPT=States( request )
# Get next/prev set of data - e.g. if next set, then it will use orig_url
# to go forward how_many from offset and then use viewer.html to show that
@@ -705,7 +705,7 @@ def view_img_post(id):
# route called from front/end - if multiple images are being transformed, each transorm == a separate call
# to this route (and therefore a separate transorm job. Each reponse allows the f/e to check the
# specific transorm job is finished (/checktransformjob) which will be called (say) every 1 sec. from f/e
# specific transorm job is finished (/check_transform_job) which will be called (say) every 1 sec. from f/e
# with a spinning wheel, then when pa_job_mgr has finished it will return the transformed thumb
@app.route("/transform", methods=["POST"])
@login_required
@@ -721,14 +721,14 @@ def transform():
return make_response( jsonify( job_id=job.id ) )
################################################################################
# /checktransformjob -> URL that is called repeatedly by front-end waiting for the
# /check_transform_job -> URL that is called repeatedly by front-end waiting for the
# b/e to finish the transform job. Once done, the new / now
# transformed image's thumbnail is returned so the f/e can
# update with it
################################################################################
@app.route("/checktransformjob", methods=["POST"])
@app.route("/check_transform_job", methods=["POST"])
@login_required
def checktransformjob():
def check_transform_job():
job_id = request.form['job_id']
job = Job.query.get(job_id)
j=jsonify( finished=False )
@@ -779,9 +779,9 @@ def _jinja2_filter_parentpath(path):
# json list of existing dir names that could be near it in time. Starting
# simple, by using YYYYMM-1, YYYYMM, YYYYMM+1 dirs
###############################################################################
@app.route("/getexistingpaths/<dt>", methods=["POST"])
@app.route("/get_existing_paths/<dt>", methods=["POST"])
@login_required
def GetExistingPathsAsDiv(dt):
def get_existing_paths(dt):
dir_ft=FileType.query.filter(FileType.name=='Directory').first()
dirs_arr=[]
for delta in range(-7, 8):