def __init__(self, title, description, url, user): """ Instantiate a new user submitted article. """ self.title = title self.description = description self.url = url self.user = user REDIS.lpush(SUBMITTED_ARTICLE_QUEUE_KEY, url)
def process(self): """ Pulls down the article or page and controls processing of the contents into article, and tags. """ page = urllib.urlopen(self.url) self.soup = BeautifulSoup(page) self.set_article() self.determine_contents() self.determine_tags() self.save_tag_associations() REDIS.lpush(ARTICLES_TO_BE_GRAPHED, self.article.id)