mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-24 15:13:03 +02:00
fix NOT NULL constraint failed: core_snapshot.created_by_id
This commit is contained in:
@@ -37,9 +37,11 @@ def remove_from_sql_main_index(snapshots: QuerySet, atomic: bool=False, out_dir:
|
|||||||
@enforce_types
|
@enforce_types
|
||||||
def write_link_to_sql_index(link: Link, created_by_id: int | None=None):
|
def write_link_to_sql_index(link: Link, created_by_id: int | None=None):
|
||||||
from core.models import Snapshot, ArchiveResult
|
from core.models import Snapshot, ArchiveResult
|
||||||
|
from abid_utils.models import get_or_create_system_user_pk
|
||||||
|
|
||||||
info = {k: v for k, v in link._asdict().items() if k in Snapshot.keys}
|
info = {k: v for k, v in link._asdict().items() if k in Snapshot.keys}
|
||||||
|
|
||||||
info['created_by_id'] = created_by_id
|
info['created_by_id'] = created_by_id or get_or_create_system_user_pk()
|
||||||
|
|
||||||
tag_list = list(dict.fromkeys(
|
tag_list = list(dict.fromkeys(
|
||||||
tag.strip() for tag in re.split(TAG_SEPARATOR_PATTERN, link.tags or '')
|
tag.strip() for tag in re.split(TAG_SEPARATOR_PATTERN, link.tags or '')
|
||||||
|
@@ -31,7 +31,7 @@ def no_empty_args(args: List[str]) -> List[str]:
|
|||||||
assert all(len(arg) for arg in args)
|
assert all(len(arg) for arg in args)
|
||||||
return args
|
return args
|
||||||
|
|
||||||
ExtractorName = Literal['wget', 'warc', 'media']
|
ExtractorName = Literal['wget', 'warc', 'media', 'singlefile'] | str
|
||||||
|
|
||||||
HandlerFuncStr = Annotated[str, AfterValidator(lambda s: s.startswith('self.'))]
|
HandlerFuncStr = Annotated[str, AfterValidator(lambda s: s.startswith('self.'))]
|
||||||
CmdArgsList = Annotated[List[str], AfterValidator(no_empty_args)]
|
CmdArgsList = Annotated[List[str], AfterValidator(no_empty_args)]
|
||||||
|
Reference in New Issue
Block a user