work out prefix and store it away in States so we can just use if in updated json data calc for files

This commit is contained in:
2025-09-26 19:24:10 +10:00
parent e0b597c58c
commit 2325dcd22a

View File

@@ -1,10 +1,12 @@
from flask import request, render_template, redirect, url_for from flask import request, render_template, redirect, url_for
from settings import Settings, SettingsIPath, SettingsSPath, SettingsRBPath
from flask_login import login_required, current_user from flask_login import login_required, current_user
from main import db, app, ma from main import db, app, ma
from shared import PA from shared import PA
from user import PAUser from user import PAUser
from datetime import datetime from datetime import datetime
from job import SetFELog from job import SetFELog
from shared import SymlinkName
import pytz import pytz
import re import re
@@ -58,6 +60,7 @@ class States(PA):
self.first_eid=0 self.first_eid=0
self.last_eid=0 self.last_eid=0
self.num_entries=0 self.num_entries=0
self.prefix=None
# this is any next/prev or noo, grouping, etc. change (so use referrer to work out what to do with this) # this is any next/prev or noo, grouping, etc. change (so use referrer to work out what to do with this)
# because this can happen on a view, or files_up, etc. change this FIRST # because this can happen on a view, or files_up, etc. change this FIRST
@@ -273,6 +276,16 @@ class States(PA):
self.current = int(request.form['current']) self.current = int(request.form['current'])
last_used=datetime.now(pytz.utc) last_used=datetime.now(pytz.utc)
# set the prefix based on path
if self.path_type == 'Storage':
path = SettingsSPath()
elif self.path_type == 'Import':
path = SettingsIPath()
elif self.path_type == 'Bin':
path = SettingsRBPath()
self.prefix = SymlinkName(self.path_type,path,path+'/')
# now save pref # now save pref
if not pref: if not pref:
# insert new pref for this combo (might be a new search or view, or first time for a path) # insert new pref for this combo (might be a new search or view, or first time for a path)