import deform from pyramid.httpexceptions import HTTPFound from pyramid.view import view_config # from ordr.models import User @view_config( context='ordr.resources.account.RegistrationResource', permission='view', request_method='GET', renderer='ordr:templates/account/registration_form.jinja2' ) def registration_form(context, request): form = context.get_registration_form() return {'form': form} @view_config( context='ordr.resources.account.RegistrationResource', permission='view', request_method='POST', renderer='ordr:templates/account/registration_form.jinja2' ) def registration_form_processing(context, request): if 'Cancel' in request.POST: return HTTPFound(request.resource_url(request.root)) form = context.get_registration_form() data = request.POST.items() try: appstruct = form.validate(data) except deform.ValidationFailure as e: pass return {'form': form}