Skip to content

Commit

Permalink
Made content take precedence over anything else
Browse files Browse the repository at this point in the history
Content usually contains the full entry, summary and description are
truncated.
  • Loading branch information
brutasse committed Jun 8, 2012
1 parent 7e8c265 commit a1143bf
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions django_website/aggregator/models.py
Expand Up @@ -124,14 +124,19 @@ def feed_updated(sender, notification, **kwargs):
log.error("Feed ID %s has an entry ('%s') without a link or guid. Skipping.", feed.id, title) log.error("Feed ID %s has an entry ('%s') without a link or guid. Skipping.", feed.id, title)
link = getattr(entry, "link", guid) link = getattr(entry, "link", guid)


content = u''
if hasattr(entry, "summary"): if hasattr(entry, "summary"):
content = entry.summary content = entry.summary
elif hasattr(entry, "content"):
content = entry.content[0].value if hasattr(entry, "description"):
elif hasattr(entry, "description"):
content = entry.description content = entry.description
else:
content = u"" # 'content' takes precedence on anything else. 'summary' and
# 'description' are usually truncated so it's safe to overwrite them
if hasattr(entry, "content"):
content = u''
for item in entry.content:
content += item.value


if entry.has_key('updated_parsed'): if entry.has_key('updated_parsed'):
date_modified = datetime.datetime(*entry.updated_parsed[:6]) date_modified = datetime.datetime(*entry.updated_parsed[:6])
Expand Down

3 comments on commit a1143bf

@jezdez
Copy link
Contributor

@jezdez jezdez commented on a1143bf Jul 24, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to remove that after complaints of broken feeds.

@brutasse
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jezdez do you have examples of impacted feeds?

@jezdez
Copy link
Contributor

@jezdez jezdez commented on a1143bf Jul 25, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind jumping on IRC quick?

Please sign in to comment.