Beispiel #1
0
def load_poem(soup, author):
    """load poem from raw_poem file into database"""

    title = Parse.parse_title(soup)
    body = Parse.parse_poem(soup)
    author_id = author.author_id
    tsv = func.to_tsvector(' '.join([title, body]))


    poem = Poem(title=title,
        body=body,
        poem_url="",
        author_id=author_id,
        tsv=tsv)

    db.session.add(poem)
    db.session.flush()

    return poem