Changeset 422
- Timestamp:
- 08/06/05 18:54:06 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
djangoproject.com/django_website/apps/aggregator/bin/update_feeds.py
r421 r422 13 13 from django.models.aggregator import feeds, feeditems 14 14 for feed in feeds.get_iterator(is_defunct__exact=False): 15 for entry in feedparser.parse(feed.feed_url).entries: 15 parsed_feed = feedparser.parse(feed.feed_url) 16 for entry in parsed_feed.entries: 17 title = entry.title.encode(parsed_feed.encoding, "xmlcharrefreplace") 18 guid = entry.get("id", entry.link).encode(parsed_feed.encoding, "xmlcharrefreplace") 19 link = entry.link.encode(parsed_feed.encoding, "xmlcharrefreplace") 20 if hasattr(entry, "summary"): 21 content = entry.summary 22 elif hasattr(entry, "content"): 23 content = entry.content[0].value 24 elif hasattr(entry, "description"): 25 content = entry.description 26 else: 27 content = u"" 28 content = content.encode(parsed_feed.encoding, "xmlcharrefreplace") 29 date_modified = datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed)) 16 30 try: 17 feeditem = feed.get_feeditem(guid__exact= str(entry.get("id", entry.link)))31 feeditem = feed.get_feeditem(guid__exact=guid) 18 32 except feeditems.FeedItemDoesNotExist: 19 for i in ("summary", "content", "description"): 20 summary = entry.get(i, "") 21 if summary: break 22 feeditem = feed.add_feeditem(title=str(entry.title), 23 link=str(entry.link), 24 summary=str(summary), 25 guid=str(entry.get("id", entry.link)), 26 date_modified=datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed))) 33 feeditem = feed.add_feeditem(title=title, 34 link=link, 35 summary=content, 36 guid=guid, 37 date_modified=date_modified) 27 38 else: 28 feeditem.date_modified = date time.datetime.fromtimestamp(time.mktime(entry.modified_parsed))39 feeditem.date_modified = date_modified 29 40 feeditem.save() 30 41 djangoproject.com/django_website/templates/aggregator/feeditems_list.html
r419 r422 18 18 19 19 <div id="content-secondary"> 20 <p>{% if has_previous %}<a href="?page={{ previous }}">Previous</a> | {% endif %} 21 Page {{ page }} of {{ pages }} 22 {% if has_next %} | <a href="?page={{ next }}">Next</a>{% endif %}</p> 20 {% if has_next %}<a href="?page={{ next }}">Earlier posts</a>{% endif %}</p> 23 21 </div> 24 22 djangoproject.com/django_website/templates/base_community.html
r419 r422 25 25 <li><a href="irc://irc.freenode.net/django">#django IRC channel on irc.freenode.net</a></li> 26 26 <li>Read the <a href="http://loglibrary.com/show_page/latest/179">IRC channel logs</a></li> 27 <li>Ask questions on the <a href="http://groups-beta.google.com/group/django-users">django-users mailing list</a></li>27 <li>Ask questions on the <a href="http://groups-beta.google.com/group/django-users">django-users mailing list</a></li> 28 28 </ul> 29 29
