Fixing stories in tabs, and adding option to specify username for refresh_feeds, to assist in development.

This commit is contained in:
Samuel Clay 2010-12-14 23:10:13 -05:00
parent 3094bb990a
commit 97ad4838f1
2 changed files with 12 additions and 6 deletions

View file

@ -1,5 +1,6 @@
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.auth.models import User
from apps.rss_feeds.models import Feed
from optparse import make_option
from utils import feed_fetcher
@ -16,6 +17,7 @@ class Command(BaseCommand):
make_option("-s", "--single_threaded", dest="single_threaded", action="store_true"),
make_option('-t', '--timeout', type='int', default=10,
help='Wait timeout in seconds when connecting to feeds.'),
make_option('-u', '--username', type='str', dest='username'),
make_option('-V', '--verbose', action='store_true',
dest='verbose', default=False, help='Verbose output.'),
make_option('-S', '--skip', type='int',
@ -42,10 +44,15 @@ class Command(BaseCommand):
return
socket.setdefaulttimeout(options['timeout'])
feeds = Feed.objects.filter(next_scheduled_update__lte=now, active=True).order_by('?')
if options['force']:
feeds = Feed.objects.all()
elif options['username']:
feeds = Feed.objects.filter(subscribers__user=User.objects.get(username=options['username']))
else:
feeds = Feed.objects.filter(next_scheduled_update__lte=now, active=True)
feeds = feeds.order_by('?')
num_workers = min(len(feeds), options['workerthreads'])
if options['single_threaded']:

View file

@ -2236,11 +2236,10 @@
if (this.active_feed == feed_id) {
this.flags['open_unread_stories_in_tabs'] = false;
_.each(this.model.stories, function(story) {
NEWSBLUR.log(['story', story, !story.read_status]);
if (!story.read_status) {
_.defer(function() {
window.open(story['story_permalink'], '_blank');
window.focus();
});
}
});
this.mark_feed_as_read(feed_id);