def home_view(request): login = authenticated_userid(request) user = DBSession.query(User).filter(User.login == login).first() try: user_pages = DBSession.query(Page).filter(Page.owner == user.id).all() except: user_pages = None return { 'user': user, 'user_pages': user_pages, 'request': request, }
def user_view(request): user = request.context pages = DBSession.query(Page).filter(Page.owner == user.id).all() return { 'user': user, 'pages': pages, }
def login_view(request): next = request.params.get('next') or request.route_url('home') login = '' did_fail = False users = DBSession.query(User).all() if 'submit' in request.POST: login = request.POST.get('login', '') passwd = request.POST.get('passwd', '') user = User.get_user(login) if user and user.validate_password(passwd): headers = remember(request, login) return HTTPFound(location=next, headers=headers) did_fail = True return { 'login': login, 'next': next, 'failed_attempt': did_fail, 'users': users, 'request': request }
def pages_view(request): pages = DBSession.query(Page).all() return {"pages": pages}
def groups_view(request): groups = DBSession.query(Group).all() return { 'groups': groups, }
def users_view(request): users = DBSession.query(User).all() return { 'users': sorted([u.login for u in users]) }
def groups_view(request): groups = DBSession.query(Group).all() return {"groups": groups}
def pages_view(request): pages = DBSession.query(Page).all() return { 'pages': pages, }