示例#1
0
文件: util.py 项目: HiPiH/life
def solutions():
    """
    Return solutions list from session
    """

    session = get_request().session
    if not 'captcha_solutions' in session:
        session['captcha_solutions'] = {}
    return session['captcha_solutions']
示例#2
0
文件: util.py 项目: HiPiH/life
def solutions():
    """
    Return solutions list from session
    """

    session = get_request().session
    if not 'captcha_solutions' in session:
        session['captcha_solutions'] = {}
    return session['captcha_solutions']
示例#3
0
文件: util.py 项目: HiPiH/life
def generate():
    """
    Generate random solution and save it in session.
    """

    solution = random_word()
    
    captcha_id =  hashlib.sha1(solution + settings.SECRET_KEY).hexdigest()
    solutions()[captcha_id] = solution
    # http://www.djangoproject.com/documentation/sessions/#when-sessions-are-saved
    get_request().session.modified = True
    return captcha_id
示例#4
0
文件: util.py 项目: HiPiH/life
def generate():
    """
    Generate random solution and save it in session.
    """

    solution = random_word()

    captcha_id = hashlib.sha1(solution + settings.SECRET_KEY).hexdigest()
    solutions()[captcha_id] = solution
    # http://www.djangoproject.com/documentation/sessions/#when-sessions-are-saved
    get_request().session.modified = True
    return captcha_id