def handle(self, *args, **options): if options['reindex']: MStory.index_all_for_search() return if not options['user']: print "Missing user. Did you want to reindex everything? Use -R." return if re.match(r"([0-9]+)", options['user']): user = User.objects.get(pk=int(options['user'])) else: user = User.objects.get(username=options['user']) subscriptions = UserSubscription.objects.filter(user=user) print " ---> Indexing %s feeds..." % subscriptions.count() for sub in subscriptions: try: sub.feed.index_stories_for_search() except Feed.DoesNotExist: print " ***> Couldn't find %s" % sub.feed_id