示例#1
0
文件: views.py 项目: Neraving/test
def my_view(request):
    nxt = request.params.get("next") or request.route_url("about")
    did_fail = False

    if "e-mail" in request.POST:
        print "DAAAAAAA!! email"
        user = register(request.POST["login"], request.POST["e-mail"], request.POST["password"])
        if user:
            headers = remember(request, user.id)
            return HTTPFound(location=nxt, headers=headers)
        else:
            did_fail = True
    return {"login": "", "next": nxt, "failed_attempt": did_fail}
示例#2
0
def my_view(request):
    nxt = request.params.get('next') or request.route_url('about')
    did_fail = False

    if 'e-mail' in request.POST:
        print "DAAAAAAA!! email"
        user = register(request.POST["login"], request.POST["e-mail"],
                        request.POST["password"])
        if user:
            headers = remember(request, user.id)
            return HTTPFound(location=nxt, headers=headers)
        else:
            did_fail = True
    return {
        'login': "",
        'next': nxt,
        'failed_attempt': did_fail,
    }
示例#3
0
def my_view(request):
    nxt = request.params.get('next') or request.route_url('profile')
    did_fail = False
    if 'e-mail' in request.POST:
        user = register(
            request.POST["login"], request.POST["e-mail"],
            request.POST["password"], request.POST['sex']
        )
        if user:
            headers = remember(request, user.id)
            return HTTPFound(location=nxt, headers=headers)
        else:
            did_fail = True
    return {
        'login': "",
        'next': nxt,
        'failed_attempt': did_fail,
    }
示例#4
0
文件: bd_test.py 项目: Neraving/test
    User,
    del_all,
    del_user,
    all_guys,
    add_guy
    )

engine = create_engine('sqlite:///gen_tree.db')
DBSession.configure(bind=engine)
Base.metadata.bind = engine
Base.metadata.create_all(engine)


#register("123123","123123","ccccc")

register("sdf,","sdf","sdf")

#del_user("123")







all_guys()

all_users()


示例#5
0
文件: bd_test.py 项目: Neraving/test
from pyramid.authentication import SessionAuthenticationPolicy
from pyramid.config import Configurator
from sqlalchemy import create_engine
from pyramid.httpexceptions import HTTPNotFound
from sqlalchemy.pool import NullPool
from myproject.models import (DBSession, Base, register, all_users, User,
                              del_all, del_user, all_guys, add_guy)

engine = create_engine('sqlite:///gen_tree.db')
DBSession.configure(bind=engine)
Base.metadata.bind = engine
Base.metadata.create_all(engine)

#register("123123","123123","ccccc")

register("sdf,", "sdf", "sdf")

#del_user("123")

all_guys()

all_users()

#del_all()