Exemple #1
0
def find_existing_posts(feed_id, post_id_hashes, post_link_hashes):
    try:

        return session.query(Post.post_id_hash, Post.link_hash).filter(
            and_(
                Post.feed_id == feed_id,
                or_(
                    Post.post_id_hash.in_(post_id_hashes),
                    Post.link_hash.in_(post_link_hashes),
                )))
    except:
        session.rollback()
        error_reporter.captureException()
        return None
Exemple #2
0
def rss_exists(url):
    rss_hash = url_hash(url)
    feed = None

    try:
        feed = session.query(Feed).filter_by(rss_hash=rss_hash).first()
    except:
        error_reporter.captureException()
        try:
            session.rollback()
        except:
            error_reporter.captureException()
        raise

    return feed