Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[website] changed some maxlengths to avoid crapping out in the aggreg…

…ator.

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@7296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 62ed0d1c6df7db6017b0f417439b9d3df7d937fd 1 parent ecbf933
authored March 18, 2008
7  django_website/apps/aggregator/bin/update_feeds.py
@@ -9,9 +9,11 @@
9 9
 import datetime
10 10
 import feedparser
11 11
 
12  
-def update_feeds():
  12
+def update_feeds(verbose=False):
13 13
     from django_website.apps.aggregator.models import Feed, FeedItem
14 14
     for feed in Feed.objects.filter(is_defunct=False):
  15
+        if verbose:
  16
+            print feed
15 17
         parsed_feed = feedparser.parse(feed.feed_url)
16 18
         for entry in parsed_feed.entries:
17 19
             title = entry.title.encode(parsed_feed.encoding, "xmlcharrefreplace")
@@ -51,7 +53,8 @@ def update_feeds():
51 53
 if __name__ == '__main__':
52 54
     parser = optparse.OptionParser()
53 55
     parser.add_option('--settings')
  56
+    parser.add_option('-v', '--verbose', action="store_true")
54 57
     options, args = parser.parse_args()
55 58
     if options.settings:
56 59
         os.environ["DJANGO_SETTINGS_MODULE"] = options.settings
57  
-    update_feeds()
  60
+    update_feeds(options.verbose)
12  django_website/apps/aggregator/models.py
... ...
@@ -1,9 +1,9 @@
1 1
 from django.db import models
2 2
 
3 3
 class Feed(models.Model):
4  
-    title = models.CharField(maxlength=200)
5  
-    feed_url = models.URLField(unique=True)
6  
-    public_url = models.URLField()
  4
+    title = models.CharField(maxlength=500)
  5
+    feed_url = models.URLField(unique=True, maxlength=500)
  6
+    public_url = models.URLField(maxlength=500)
7 7
     is_defunct = models.BooleanField()
8 8
 
9 9
     class Meta:
@@ -17,11 +17,11 @@ def __unicode__(self):
17 17
 
18 18
 class FeedItem(models.Model):
19 19
     feed = models.ForeignKey(Feed)
20  
-    title = models.CharField(maxlength=200)
21  
-    link = models.URLField()
  20
+    title = models.CharField(maxlength=500)
  21
+    link = models.URLField(maxlength=500)
22 22
     summary = models.TextField(blank=True)
23 23
     date_modified = models.DateTimeField()
24  
-    guid = models.CharField(maxlength=200, unique=True, db_index=True)
  24
+    guid = models.CharField(maxlength=500, unique=True, db_index=True)
25 25
 
26 26
     class Meta:
27 27
         db_table = 'aggregator_feeditems'

0 notes on commit 62ed0d1

Please sign in to comment.
Something went wrong with that request. Please try again.