6 Commits

Author SHA1 Message Date
vegardbm f4ae9f6c9e import os 2026-03-18 18:44:14 +01:00
vegardbm 9e0065d849 debug 2026-03-18 18:30:47 +01:00
vegardbm b996be7c7f submissive and breedable 2026-03-18 18:09:23 +01:00
vegardbm a0da34de7e test if password is read correctly 2026-03-18 17:43:56 +01:00
vegardbm c564ee0b99 strip from password file 2026-03-18 17:21:39 +01:00
vegardbm 9bdaaf6c51 allow using stable dep versions 2026-03-18 12:17:27 +01:00
3 changed files with 6 additions and 10 deletions
-6
View File
@@ -75,8 +75,6 @@ class WorblehatCli(NumberedCmd):
)
bookcase_selector.cmdloop()
bookcase = bookcase_selector.result
if bookcase == None:
return
for shelf in bookcase.shelfs:
print(shelf.short_str())
@@ -140,8 +138,6 @@ class WorblehatCli(NumberedCmd):
)
bookcase_selector.cmdloop()
bookcase = bookcase_selector.result
if bookcase == None:
return
bookcase_item.shelf = select_bookcase_shelf(bookcase, self.sql_session)
@@ -156,8 +152,6 @@ class WorblehatCli(NumberedCmd):
media_type_selector.cmdloop()
bookcase_item.media_type = media_type_selector.result
if bookcase_item.media_type == None:
return
username = input("Who owns this book? [PVV]> ")
if username != "":
@@ -384,8 +384,6 @@ class EditBookcaseCli(NumberedCmd):
)
bookcase_selector.cmdloop()
bookcase = bookcase_selector.result
if bookcase == None:
return
assert isinstance(bookcase, Bookcase)
shelf = select_bookcase_shelf(bookcase, self.sql_session)
+6 -2
View File
@@ -2,7 +2,7 @@ import tomllib
from pathlib import Path
from pprint import pformat
from typing import Any
import os
class Config:
"""
@@ -38,10 +38,14 @@ class Config:
@staticmethod
def read_password(password_field: str) -> str:
if Path(password_field).is_file():
file: Path = Path(password_field)
if file.is_file() and any([file.stat().st_mode & 0o400 and file.stat().st_uid == os.getuid(), file.stat().st_mode & 0o040 and file.stat().st_gid == os.getgid(), file.stat().st_mode & 0o004]):
with Path(password_field).open() as f:
return f.read().strip()
else:
raise RuntimeError(
f"Testing, should only use file. {password_field}",
)
return password_field
@classmethod