Compare commits
6 Commits
main
..
stable_deps
| Author | SHA1 | Date | |
|---|---|---|---|
| f4ae9f6c9e | |||
| 9e0065d849 | |||
| b996be7c7f | |||
| a0da34de7e | |||
| c564ee0b99 | |||
| 9bdaaf6c51 |
Generated
+4
-4
@@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780178524,
|
"lastModified": 1769338528,
|
||||||
"narHash": "sha256-2PcNyNqbGCWBpAMdCU1HxSQmhQiG6evdjxVnPA7w5bQ=",
|
"narHash": "sha256-t18ZoSt9kaI1yde26ok5s7aFLkap1Q9+/2icVh2zuaE=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "2406de41ce9d0a1404cbf4e55537e3f720f37f23",
|
"rev": "7218348163fd8d84df4a6f682c634793e67a3fed",
|
||||||
"revCount": 15,
|
"revCount": 13,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.pvv.ntnu.no/Projects/libdib.git"
|
"url": "https://git.pvv.ntnu.no/Projects/libdib.git"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -75,8 +75,6 @@ class WorblehatCli(NumberedCmd):
|
|||||||
)
|
)
|
||||||
bookcase_selector.cmdloop()
|
bookcase_selector.cmdloop()
|
||||||
bookcase = bookcase_selector.result
|
bookcase = bookcase_selector.result
|
||||||
if bookcase == None:
|
|
||||||
return
|
|
||||||
|
|
||||||
for shelf in bookcase.shelfs:
|
for shelf in bookcase.shelfs:
|
||||||
print(shelf.short_str())
|
print(shelf.short_str())
|
||||||
@@ -140,8 +138,6 @@ class WorblehatCli(NumberedCmd):
|
|||||||
)
|
)
|
||||||
bookcase_selector.cmdloop()
|
bookcase_selector.cmdloop()
|
||||||
bookcase = bookcase_selector.result
|
bookcase = bookcase_selector.result
|
||||||
if bookcase == None:
|
|
||||||
return
|
|
||||||
|
|
||||||
bookcase_item.shelf = select_bookcase_shelf(bookcase, self.sql_session)
|
bookcase_item.shelf = select_bookcase_shelf(bookcase, self.sql_session)
|
||||||
|
|
||||||
@@ -156,8 +152,6 @@ class WorblehatCli(NumberedCmd):
|
|||||||
|
|
||||||
media_type_selector.cmdloop()
|
media_type_selector.cmdloop()
|
||||||
bookcase_item.media_type = media_type_selector.result
|
bookcase_item.media_type = media_type_selector.result
|
||||||
if bookcase_item.media_type == None:
|
|
||||||
return
|
|
||||||
|
|
||||||
username = input("Who owns this book? [PVV]> ")
|
username = input("Who owns this book? [PVV]> ")
|
||||||
if username != "":
|
if username != "":
|
||||||
|
|||||||
@@ -384,8 +384,6 @@ class EditBookcaseCli(NumberedCmd):
|
|||||||
)
|
)
|
||||||
bookcase_selector.cmdloop()
|
bookcase_selector.cmdloop()
|
||||||
bookcase = bookcase_selector.result
|
bookcase = bookcase_selector.result
|
||||||
if bookcase == None:
|
|
||||||
return
|
|
||||||
assert isinstance(bookcase, Bookcase)
|
assert isinstance(bookcase, Bookcase)
|
||||||
|
|
||||||
shelf = select_bookcase_shelf(bookcase, self.sql_session)
|
shelf = select_bookcase_shelf(bookcase, self.sql_session)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import tomllib
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
import os
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
"""
|
"""
|
||||||
@@ -38,10 +38,14 @@ class Config:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read_password(password_field: str) -> str:
|
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:
|
with Path(password_field).open() as f:
|
||||||
return f.read().strip()
|
return f.read().strip()
|
||||||
else:
|
else:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Testing, should only use file. {password_field}",
|
||||||
|
)
|
||||||
return password_field
|
return password_field
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user