コード例 #1
0
ファイル: judgement.py プロジェクト: gulnara/movie_ratings
def shutdown_session(exception = None):
    db_session.remove()
コード例 #2
0
def cleanup(resp_or_exc):
    db.remove() # ici on vide la base de données
コード例 #3
0
def shutdown_session(exception=None):
    db_session.remove()
コード例 #4
0
ファイル: judgement.py プロジェクト: sgottlieb/ratings
def unload(exception = None):
    db_session.remove()
コード例 #5
0
def index():
    session.remove()

    tweets_json = []
    tier_dic = {
        "": {
            "checked": False,
            "rank": "",
            "name": "全て"
        },
        "MASTER": {
            "checked": False,
            "rank": "Master",
            "name": "Master"
        },
        "SSS": {
            "checked": False,
            "rank": "SSS",
            "name": "SSS"
        },
        "SS": {
            "checked": False,
            "rank": "SS",
            "name": "SS"
        },
        "S": {
            "checked": False,
            "rank": "S",
            "name": "S"
        },
        "A": {
            "checked": False,
            "rank": "A",
            "name": "A"
        },
        "B": {
            "checked": False,
            "rank": "B",
            "name": "B"
        },
        "C": {
            "checked": False,
            "rank": "C",
            "name": "C"
        },
        "D": {
            "checked": False,
            "rank": "D",
            "name": "D"
        },
        "E": {
            "checked": False,
            "rank": "E",
            "name": "E"
        },
    }
    chara_dic = {
        "": {
            "checked": False,
            "character": "",
            "name": "全て"
        },
        "グラン": {
            "checked": False,
            "character": "グラン",
            "name": "グラン"
        },
        "カタリナ": {
            "checked": False,
            "character": "カタリナ",
            "name": "カタリナ"
        },
        "シャル": {
            "checked": False,
            "character": "シャル",
            "name": "シャルロッテ"
        },
        "ランス": {
            "checked": False,
            "character": "ランス",
            "name": "ランスロット"
        },
        "パー": {
            "checked": False,
            "character": "パー",
            "name": "パーシヴァル"
        },
        "フェリ": {
            "checked": False,
            "character": "フェリ",
            "name": "フェリ"
        },
        "ローアイン": {
            "checked": False,
            "character": "ローアイン",
            "name": "ローアイン"
        },
        "ファスティバ": {
            "checked": False,
            "character": "ファスティバ",
            "name": "ファスティバ"
        },
        "メーテラ": {
            "checked": False,
            "character": "メーテラ",
            "name": "メーテラ"
        },
        "ゼタ": {
            "checked": False,
            "character": "ゼタ",
            "name": "ゼタ"
        },
        "バザラガ": {
            "checked": False,
            "character": "バザラガ",
            "name": "バザラガ"
        },
        "バブ": {
            "checked": False,
            "character": "バブ",
            "name": "ベルゼバブ"
        },
        "ナルメア": {
            "checked": False,
            "character": "ナルメア",
            "name": "ナルメア"
        },
        "ソリッズ": {
            "checked": False,
            "character": "ソリッズ",
            "name": "ソリッズ"
        },
        "ジータ": {
            "checked": False,
            "character": "ジータ",
            "name": "ジータ"
        },
        "ゾーイ": {
            "checked": False,
            "character": "ゾーイ",
            "name": "ゾーイ"
        },
        "ベリアル": {
            "checked": False,
            "character": "ベリアル",
            "name": "ベリアル"
        },
        "カリオストロ": {
            "checked": False,
            "character": "カリ",
            "name": "カリオストロ"
        },
        "ユエル": {
            "checked": False,
            "character": "ユエル",
            "name": "ユエル"
        },
        "ウーノ": {
            "checked": False,
            "character": "ウーノ",
            "name": "ウーノ"
        },
    }

    dt_now = datetime.now()
    tier = request.args.get("rank_tiers")
    character = request.args.get("character")

    if tier and character:
        tweets = session.query(Tweet).filter(
            Tweet.rank_tier == tier,
            Tweet.character.like("%{}%".format(character))).order_by(
                desc(Tweet.tweeted_at)).limit(20).offset(0).all()
        tier_dic[tier]["checked"] = True
        chara_dic[character]["checked"] = True

    elif (not tier) and character:
        tweets = session.query(Tweet).filter(
            Tweet.character.like("%{}%".format(character))).order_by(
                desc(Tweet.tweeted_at)).limit(20).offset(0).all()
        tier_dic[""]["checked"] = True
        chara_dic[character]["checked"] = True

    elif tier and (not character):
        tweets = session.query(Tweet).filter(Tweet.rank_tier == tier).order_by(
            desc(Tweet.tweeted_at)).limit(20).offset(0).all()
        tier_dic[tier]["checked"] = True
        chara_dic[""]["checked"] = True

    else:
        tweets = session.query(Tweet).order_by(desc(
            Tweet.tweeted_at)).limit(20).offset(0).all()
        tier_dic[""]["checked"] = True
        chara_dic[""]["checked"] = True

    for tweet in tweets:
        tweets_json.append({
            "tweet_id":
            tweet.tweet_id,
            "twitter_id":
            tweet.twitter_id,
            "twitter_name":
            tweet.twitter_name,
            "tweeted_at":
            tweet.tweeted_at,
            "rank_tier":
            tweet.rank_tier,
            "player_name":
            tweet.player_name,
            "character":
            tweet.character,
            "rank":
            tweet.rank,
            "vsid":
            tweet.vsid,
            "comment":
            tweet.comment,
            "elapsed_time":
            parse_elapsed(str(dt_now - tweet.tweeted_at))
        })
    return render_template("index.html",
                           tweets=tweets_json,
                           tiers=tier_dic,
                           characters=chara_dic)
コード例 #6
0
ファイル: main.py プロジェクト: pamsilva/graphql-mtc
def shutdown_session(exception=None):
    session.remove()
    print 'POTATO'
コード例 #7
0
def remove_session(exception=None):
    db_session.remove()
コード例 #8
0
ファイル: host.py プロジェクト: FluidPlay/SPA
 def run(self):
     log.info('HostCommand start')
     self.handle(self.input_data, self.source)
     session.remove()
     log.info('HostCommand run finished')
     self.active = False