コード例 #1
0
ファイル: views.py プロジェクト: paveldedik/gplus-friends
def index():
    """Homepage of the application.
    :return: HTML document.
    """
    token = get_access_token()
    if token is None:
        return render_template('loggedout.html')
    else:
        return render_template('loggedin.html')
コード例 #2
0
ファイル: tasks.py プロジェクト: paveldedik/gplus-friends
    def wrapper(entity_id):
        token = get_access_token()

        if token is None:
            return None

        token_hash = md5(token[0]).hexdigest()
        cache_key = "{0}-{1}".format(entity_id, token_hash)
        data = cache.get(cache_key)

        if data is None:
            data = func(entity_id)
            cache.set(cache_key, data, timeout=30 * 60)  # 30 minutes

        return data