def get_feedlist_for_user(user_id): subs = Subscription.get_by_user(user_id) feedlist = [Feed.get_by_id(sub.feed_id) for sub in subs] state = 'ok' return { 'state': state, 'feedlist': feedlist }
def fetch_feed(self, feed_id): feed = Feed.get_by_id(feed_id) if not feed: return url = ('https://www.google.com/reader/public/atom/feed/%s?n=%d' % (feed.feed_address, self.max_n)) try: fetched_feed = feedparser.parse(url) FetchedFeed(feed_id).save() pfeed = ProcessFeed(feed, fetched_feed, {}); ret, feed = pfeed.process() jug.publish('import:google-reader-history', {'state':'ok', 'feed_id': feed_id }) except Exception, e: print e jug.publish('import:google-reader-history', {'state':'error', 'feed_id':feed_id})