Unable to add SkippedContent with an origin using PostgreSQL storage
Trying to add a SkippedContent
object with an URL set in the origin
field will result in the following piece of code being executed:
origin_ids = db.origin_id_get_by_url([cont.origin for cont in content], cur=cur)
content = [
attr.evolve(c, origin=origin_id)
for (c, origin_id) in zip(content, origin_ids)
]
It will fail if the origin
field of any SkippedContent
is set to an URL matching an existing origin because:
-
db.origin_id_get_by_url()
return type isList[Optional[int]]
- The
origin
field is defined asOptional[str]
.
The type mismatch result in an exception:
attrs_strict._error.AttributeTypeError: origin must be typing.Optional[str] (got 1 that is a <class 'int'>)