From 2325dcd22a735710a21f77e2f25720320efd9111 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Fri, 26 Sep 2025 19:24:10 +1000 Subject: [PATCH] work out prefix and store it away in States so we can just use if in updated json data calc for files --- states.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/states.py b/states.py index afbc866..2dcf244 100644 --- a/states.py +++ b/states.py @@ -1,10 +1,12 @@ 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 main import db, app, ma from shared import PA from user import PAUser from datetime import datetime from job import SetFELog +from shared import SymlinkName import pytz import re @@ -58,6 +60,7 @@ class States(PA): self.first_eid=0 self.last_eid=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) # 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']) 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 if not pref: # insert new pref for this combo (might be a new search or view, or first time for a path)