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}
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, }
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, }
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()
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()