Show More
@@ -57,7 +57,7 b' class ThreadSource(models.Model):' | |||
|
57 | 57 | feed = feedparser.parse(self.source) |
|
58 | 58 | items = sorted(feed.entries, key=lambda entry: entry.published_parsed) |
|
59 | 59 | for item in items: |
|
60 |
title = item.title |
|
|
60 | title = self.strip_title(item.title, TITLE_MAX_LENGTH) | |
|
61 | 61 | timestamp = datetime.fromtimestamp(calendar.timegm(item.published_parsed), tz=utc) |
|
62 | 62 | if not timestamp: |
|
63 | 63 | logger.error('Invalid timestamp {} for {}'.format(item.published, title)) |
@@ -75,3 +75,10 b' class ThreadSource(models.Model):' | |||
|
75 | 75 | |
|
76 | 76 | def parse_text(self, text): |
|
77 | 77 | return strip_tags(text) |
|
78 | ||
|
79 | def strip_title(self, title, max_length): | |
|
80 | result = title | |
|
81 | if len(title) > max_length: | |
|
82 | result = title[:max_length - 1] + '…' | |
|
83 | return result | |
|
84 |
General Comments 0
You need to be logged in to leave comments.
Login now