first pass of versioning, working for files.html only for now
This commit is contained in:
26
files.py
26
files.py
@@ -270,23 +270,12 @@ class EntrySchema(ma.SQLAlchemyAutoSchema):
|
||||
def get_full_path(self, obj):
|
||||
return obj.FullPathOnFS()
|
||||
|
||||
# quick helper func to return the timestampe of a (jscript) file.
|
||||
# we use this as a quick/hacky way of versioning the jscript file
|
||||
def get_version(fname):
|
||||
mtime = os.path.getmtime(fname)
|
||||
return int(mtime) # Use timestamp as version
|
||||
|
||||
# global - this will be use more than once below, so do it once for efficiency
|
||||
entries_schema = EntrySchema(many=True)
|
||||
FOT_Schema = FaceOverrideTypeSchema(many=True)
|
||||
path_Schema = PathSchema(many=True)
|
||||
person_Schema = PersonSchema(many=True)
|
||||
|
||||
js_vers={}
|
||||
js_vers['fs'] = get_version( url_for( 'internal', filename='js/files_support.js') )
|
||||
js_vers['vs'] = get_version( url_for( 'internal', filename='js/view_support.js') )
|
||||
js_vers['ft'] = get_version( url_for( 'internal', filename='js/files_transform.js') )
|
||||
|
||||
################################################################################
|
||||
# /get_entries_by_ids -> route where we supply list of entry ids (for next/prev
|
||||
# page of data we want to show). Returns json of all matching entries
|
||||
@@ -482,6 +471,7 @@ def file_list_ip():
|
||||
def files_ip():
|
||||
OPT=States( request )
|
||||
query_data = GetQueryData( OPT )
|
||||
js_vers = getVersions()
|
||||
return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data, js_vers=js_vers )
|
||||
|
||||
################################################################################
|
||||
@@ -782,3 +772,17 @@ def get_existing_paths(dt):
|
||||
first_dir=0
|
||||
ret+= ' ]'
|
||||
return make_response( ret )
|
||||
|
||||
# quick helper func to return timestamps of jscript files
|
||||
# we use this as a quick/hacky way of versioning them
|
||||
def getVersions():
|
||||
js_vers={}
|
||||
js_vers['fs'] = int(os.path.getmtime( "."+url_for( 'internal', filename='js/files_support.js') ))
|
||||
js_vers['vs'] = int(os.path.getmtime( "."+url_for( 'internal', filename='js/view_support.js') ))
|
||||
js_vers['ft'] = int(os.path.getmtime( "."+url_for( 'internal', filename='js/files_transform.js') ))
|
||||
js_vers['ic'] = int(os.path.getmtime( "."+url_for( 'internal', filename='icons.svg') ))
|
||||
js_vers['r180'] = int(os.path.getmtime( "."+url_for( 'internal', filename='rot180.png') ))
|
||||
js_vers['r270'] = int(os.path.getmtime( "."+url_for( 'internal', filename='rot270.png') ))
|
||||
js_vers['r90'] = int(os.path.getmtime( "."+url_for( 'internal', filename='rot90.png') ))
|
||||
js_vers['th'] = int(os.path.getmtime( "."+url_for( 'internal', filename='throbber.gif') ))
|
||||
return js_vers
|
||||
|
||||
Reference in New Issue
Block a user