def add_project(request): retval = {"body_id": "add_project"} if "submit" in request.POST: controls = request.POST.items() try: appstruct = Form(forms.project).validate(controls) except ValidationFailure, e: retval.update({"form": e.render()}) return retval appstruct["address_id"] = appstruct.pop("address") DBSession.add(Project(**appstruct)) retval.update({"form": "Success"}) return retval