Exemple #1
0
def get_or_update_player(nickname, age):
    player = get_player_nickname(nickname)
    fallback = False
    if player is None:
        new = update_player(nickname)
        if new:
            return (new, fallback)
        else:
            return (None, fallback)
    if needs_update(player.updated, age):
        updated = update_player(player.nickname, player)
        if updated is not None:
            if updated.avatar_updated is None or needs_update(player.avatar_updated, 1209600):
                avatar.delay(updated.id)
            return (updated, fallback)
        else:
            fallback = True
    return (player, fallback)
def run(settings):
    force = False
    verbosity = 1

    from utils import needs_update, filter_css, filter_js

    for name, css in settings['COMPRESS_CSS'].items():
        u, version = needs_update(css['output_filename'],
            css['source_filenames'])

        if (force or u) or verbosity >= 2:
            msg = 'CSS Group \'%s\'' % name
            print msg
            print len(msg) * '-'
            print "Version: %s" % version

        if force or u:
            filter_css(css, verbosity)

        if (force or u) or verbosity >= 2:
            print

    for name, js in settings['COMPRESS_JS'].items():
        u, version = needs_update(js['output_filename'],
            js['source_filenames'])

        if (force or u) or verbosity >= 2:
            msg = 'JavaScript Group \'%s\'' % name
            print msg
            print len(msg) * '-'
            print "Version: %s" % version

        if force or u:
            filter_js(js, verbosity)

        if (force or u) or verbosity >= 2:
            print
Exemple #3
0
def get_or_update_history(pid):
    p = Player.query.get(pid)
    url = '/match_history/all/accountid/' + str(pid)
    # player doesn't exist
    if p is None:
        return None
    # history never done
    if p.history_updated is None:
        raw = get_json(url)
        if raw:
            return update_history(p, raw)
        else:
            return None
    if needs_update(p.history_updated, 800):
        raw = get_json(url)
        if raw:
            return update_history(p, raw)
    return p