mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 04:16:24 -05:00
Removing optional_session, passing session down from request middleware. Moving session param to the front of functions.
This commit is contained in:
parent
1747442db3
commit
344fe9035f
70 changed files with 1035 additions and 1110 deletions
|
|
@ -41,7 +41,7 @@ async def import_pbfs(_: Request, body: schema.ImportPost):
|
|||
@map_bp.get('/files')
|
||||
@openapi.description('Find any map files, get their import status')
|
||||
def get_files_status(request: Request):
|
||||
paths = lib.get_import_status()
|
||||
paths = lib.get_import_status(request.ctx.session)
|
||||
paths = sorted(paths, key=lambda i: str(i.path))
|
||||
pending = request.app.shared_ctx.map_importing.get('pending')
|
||||
if pending:
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from wrolpi.api_utils import api_app
|
|||
from wrolpi.cmd import SUDO_BIN, run_command
|
||||
from wrolpi.common import get_media_directory, walk, logger, get_wrolpi_config
|
||||
from wrolpi.dates import timedelta_to_timestamp, seconds_to_timestamp, now
|
||||
from wrolpi.db import optional_session, get_db_session
|
||||
from wrolpi.db import get_db_session
|
||||
from wrolpi.events import Events
|
||||
from wrolpi.vars import PROJECT_DIR, IS_RPI5
|
||||
|
||||
|
|
@ -208,8 +208,7 @@ async def run_import_command(*paths: Path):
|
|||
raise ValueError(f'Importing map file failed with return code {result.return_code}')
|
||||
|
||||
|
||||
@optional_session
|
||||
def get_import_status(session: Session = None) -> List[MapFile]:
|
||||
def get_import_status(session: Session) -> List[MapFile]:
|
||||
paths = get_map_paths()
|
||||
map_paths = []
|
||||
for path in paths:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue