예제 #1
0
def create(email, password, handle=None, is_admin=False):
    u = model.User.create(email=email, handle=handle, is_admin=is_admin)
    u.set_password(password)

    Session.commit()

    return u
예제 #2
0
def email_verify(user_id, email_token):
    u = model.User.get_by(id=user_id, email_token=email_token)

    if not u:
        raise APIError('Invalid user: %s' % user_id)

    u.email_token = None
    Session.commit()

    return u
예제 #3
0
def _teardown_session(request):
    "Clear SQLAlchemy in-memory cache between requests."
    from foo.model.meta import Session

    Session.remove()