コード例 #1
0
ファイル: quotes.py プロジェクト: KnightHawk3/kochira
def _add_quote(storage, network, channel, origin, quote):
    with database.transaction():
        quote = Quote.create(by=origin, quote=quote, channel=channel,
                             network=network, ts=datetime.utcnow())
        quote.save()

        with storage.index.writer() as writer:
            writer.add_document(id=quote.id, by=quote.by,
                                quote=quote.quote, channel=quote.channel,
                                network=quote.network, ts=quote.ts)

    return quote
コード例 #2
0
def _add_quote(storage, network, channel, origin, quote):
    with database.transaction():
        quote = Quote.create(by=origin, quote=quote, channel=channel,
                             network=network, ts=datetime.utcnow())
        quote.save()

        with storage.index.writer() as writer:
            writer.add_document(id=quote.id, by=quote.by,
                                quote=quote.quote, channel=quote.channel,
                                network=quote.network, ts=quote.ts)

    return quote
コード例 #3
0
ファイル: quotes.py プロジェクト: KnightHawk3/kochira
def _delete_quote(storage, qid):
    with database.transaction():
        Quote.delete().where(Quote.id == qid).execute()
        storage.index.delete_by_term("id", qid)
コード例 #4
0
ファイル: quotes.py プロジェクト: anders/kochira
def _delete_quote(storage, qid):
    with database.transaction():
        Quote.delete().where(Quote.id == qid).execute()
        storage.index.delete_by_term("id", qid)