def user_register_validator(form, values): exception = Invalid(form, "There was a problem with your submission") if values["password"] != values["confirm_password"]: exception["confirm_password"] = "******" user = User.objects(name=values["name"]) if user: exception["name"] = "You have to choose a unique name" user = User.objects(email=values["email"]) if user: exception["email"] = "Email already exists in our database" if exception.children: raise exception
def user_register_validator(form, values): exception = Invalid(form, 'There was a problem with your submission') if values['password'] != values['confirm_password']: exception['confirm_password'] = '******' user = User.objects(name=values['name']) if user: exception['name'] = 'You have to choose a unique name' user = User.objects(email=values['email']) if user: exception['email'] = 'Email already exists in our database' if exception.children: raise exception
def error_page(request): available_projects = request.registry.settings['projects'] selected_project = get_selected_project(request) search = request.GET.get('search', '') show = request.GET.get('show', 'open') # open, resolved, mine order_by = request.GET.get('order_by', 'date') direction = request.GET.get('direction', 'desc') if show not in ['open', 'resolved', 'mine']: show = 'open' errors = get_errors(request) return { 'search': search, 'errors': errors, 'selected_project': selected_project, 'available_projects': available_projects, 'show': show, 'order_by': order_by, 'direction': direction, 'tags': Tag.objects(), 'users': User.objects(), }
def user_inner_validator(form, values): exception = Invalid(form, "There was a problem with your submission") if values["password"] and values["password"] != values["confirm_password"]: exception["confirm_password"] = "******" user = User.objects(name=values["name"]) if user and values["name"] != current_user.name: exception = unique_exception(exception, "name") user = User.objects(email=values["email"]) if user and values["email"] != current_user.email: exception = unique_exception(exception, "email") if exception.children: raise exception
def user_register_validator(form, values): exception = Invalid(form, 'There was a problem with your submission') if values['password'] != values['confirm_password']: exception[ 'confirm_password'] = '******' user = User.objects(name=values['name']) if user: exception['name'] = 'You have to choose a unique name' user = User.objects(email=values['email']) if user: exception['email'] = 'Email already exists in our database' if exception.children: raise exception
def user_inner_validator(form, values): exception = Invalid(form, 'There was a problem with your submission') if values['password'] and values['password'] != values[ 'confirm_password']: exception[ 'confirm_password'] = '******' user = User.objects(name=values['name']) if user and values['name'] != current_user.name: exception = unique_exception(exception, 'name') user = User.objects(email=values['email']) if user and values['email'] != current_user.email: exception = unique_exception(exception, 'email') if exception.children: raise exception
def list(request): available_projects = request.registry.settings['projects'] selected_project = get_selected_project(request) search = request.params.get('search', '') show = request.GET.getall('show') tags = request.GET.getall('tags') users = request.GET.getall('users') order_by = request.params.get('order', False) direction = request.params.get('direction', False) errors = Error.objects.find_for_list(selected_project, request.user, show) if search: errors = errors.search(search) if tags: errors.filter(tags__in=tags) if users: errors.filter(claimedby__in=users) if order_by != False and errors.count(): if direction and direction == 'desc': order_by = '-' + order_by errors.order_by(order_by) page = request.params.get('page', '1') paginator = Paginator(errors, size_per_page=20, current_page=page) params = { 'search': search, 'errors': paginator.get_current_page(), 'paginator': paginator, 'selected_project': selected_project, 'available_projects': available_projects, 'show': show, 'tags': Tag.objects(), 'users': User.objects(), 'get_error_count': lambda x: Error.objects.find_for_list(selected_project, request.user, x).count() } return render_to_response('error-list.html', params)
def add_user_to_request(event): request = event.request userid = authenticated_userid(request) if (userid): request.user = User.objects().with_id(userid)
def admin_user(request): return { 'users': User.objects() }