don't use entire post if it is in the "summary".
This commit is contained in:
parent
929b9fb5ef
commit
365b7e7d78
|
@ -117,7 +117,7 @@ class Command(BaseCommand):
|
||||||
if not opt_out:
|
if not opt_out:
|
||||||
author_name = getattr(
|
author_name = getattr(
|
||||||
article, "author", None
|
article, "author", None
|
||||||
) or getattr(blog, "author", None)
|
) or getattr(blog, "author", "")
|
||||||
|
|
||||||
description = (
|
description = (
|
||||||
html.strip_tags(article.summary)
|
html.strip_tags(article.summary)
|
||||||
|
@ -125,20 +125,26 @@ class Command(BaseCommand):
|
||||||
hasattr(article, "summary")
|
hasattr(article, "summary")
|
||||||
and len(article.summary) > 0
|
and len(article.summary) > 0
|
||||||
)
|
)
|
||||||
else html.strip_tags(article.description)
|
else (
|
||||||
|
html.strip_tags(article.description)
|
||||||
if (
|
if (
|
||||||
hasattr(article, "description")
|
hasattr(article, "description")
|
||||||
and len(article.summary)
|
and len(article.summary)
|
||||||
)
|
)
|
||||||
else html.strip_tags(article.content[0].value)[:200]
|
else (
|
||||||
|
html.strip_tags(article.content[0].value)
|
||||||
if (
|
if (
|
||||||
hasattr(article, "content")
|
hasattr(article, "content")
|
||||||
and len(article.content)
|
and len(article.content)
|
||||||
)
|
)
|
||||||
else ""
|
else None
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
if description:
|
if description:
|
||||||
description += "..."
|
description[:200] += "..."
|
||||||
|
else:
|
||||||
|
description = ""
|
||||||
|
|
||||||
instance = models.Article.objects.create(
|
instance = models.Article.objects.create(
|
||||||
title=article.title,
|
title=article.title,
|
||||||
|
@ -168,7 +174,9 @@ class Command(BaseCommand):
|
||||||
if newish:
|
if newish:
|
||||||
instance.announce()
|
instance.announce()
|
||||||
blog.set_success(
|
blog.set_success(
|
||||||
updateddate=date_to_tz_aware(article.updated_parsed)
|
updateddate=date_to_tz_aware(
|
||||||
|
article.updated_parsed
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -191,7 +199,7 @@ class Command(BaseCommand):
|
||||||
| Q(guid=getattr(edition, "id", edition.link))
|
| Q(guid=getattr(edition, "id", edition.link))
|
||||||
).exists():
|
).exists():
|
||||||
author_name = getattr(edition, "author", None) or getattr(
|
author_name = getattr(edition, "author", None) or getattr(
|
||||||
edition, "author", None
|
edition, "author", ""
|
||||||
)
|
)
|
||||||
|
|
||||||
description = (
|
description = (
|
||||||
|
@ -199,20 +207,26 @@ class Command(BaseCommand):
|
||||||
if (
|
if (
|
||||||
hasattr(edition, "summary") and len(edition.summary)
|
hasattr(edition, "summary") and len(edition.summary)
|
||||||
)
|
)
|
||||||
else html.strip_tags(edition.description)
|
else (
|
||||||
|
html.strip_tags(edition.description)
|
||||||
if (
|
if (
|
||||||
hasattr(edition, "description")
|
hasattr(edition, "description")
|
||||||
and len(edition.description)
|
and len(edition.description)
|
||||||
)
|
)
|
||||||
else html.strip_tags(edition.content[0].value)[:200] + "..."
|
else (
|
||||||
|
html.strip_tags(edition.content[0].value)
|
||||||
if (
|
if (
|
||||||
hasattr(article, "content")
|
hasattr(article, "content")
|
||||||
and len(article.content)
|
and len(article.content)
|
||||||
)
|
)
|
||||||
else ""
|
else None
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
if description:
|
if description:
|
||||||
description += "..."
|
description[:200] += "..."
|
||||||
|
else:
|
||||||
|
description = ""
|
||||||
|
|
||||||
instance = models.Edition.objects.create(
|
instance = models.Edition.objects.create(
|
||||||
title=edition.title,
|
title=edition.title,
|
||||||
|
|
Loading…
Reference in a new issue