fix a few edge cases
This commit is contained in:
parent
7416676462
commit
a06eccf827
3 changed files with 12 additions and 12 deletions
|
@ -654,7 +654,7 @@ class Item(PolymorphicModel):
|
|||
|
||||
@property
|
||||
def brief_description(self):
|
||||
return (self.display_description or "")[:155]
|
||||
return (str(self.display_description) or "")[:155]
|
||||
|
||||
@classmethod
|
||||
def get_by_url(cls, url_or_b62: str, resolve_merge=False) -> "Self | None":
|
||||
|
|
|
@ -131,18 +131,18 @@ class AbstractSite:
|
|||
ids = resource.get_lookup_ids(cls.DEFAULT_MODEL)
|
||||
for t, v in ids:
|
||||
matched = None
|
||||
# matched = model.objects.filter(
|
||||
# primary_lookup_id_type=t,
|
||||
# primary_lookup_id_value=v,
|
||||
# title=resource.metadata["title"],
|
||||
# ).first()
|
||||
# if matched is None and resource.id_type not in [
|
||||
# IdType.DoubanMusic, # DoubanMusic has many dirty data with same UPC
|
||||
# # IdType.Goodreads, # previous scraper generated some dirty data
|
||||
# ]:
|
||||
matched = model.objects.filter(
|
||||
primary_lookup_id_type=t,
|
||||
primary_lookup_id_value=v,
|
||||
title=resource.metadata["title"],
|
||||
primary_lookup_id_type=t, primary_lookup_id_value=v
|
||||
).first()
|
||||
if matched is None and resource.id_type not in [
|
||||
IdType.DoubanMusic, # DoubanMusic has many dirty data with same UPC
|
||||
# IdType.Goodreads, # previous scraper generated some dirty data
|
||||
]:
|
||||
matched = model.objects.filter(
|
||||
primary_lookup_id_type=t, primary_lookup_id_value=v
|
||||
).first()
|
||||
if matched is None:
|
||||
matched = model.objects.filter(
|
||||
primary_lookup_id_type=resource.id_type,
|
||||
|
|
|
@ -40,7 +40,7 @@ class Email:
|
|||
fail_silently=False,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"send email to {email} failed: {e}", extra={"exception": e})
|
||||
logger.error(f"send email to {email} failed: {e}")
|
||||
|
||||
@staticmethod
|
||||
def generate_login_email(email: str, action: str) -> tuple[str, str]:
|
||||
|
|
Loading…
Add table
Reference in a new issue