def update(slug): project = object_or_404(Project.by_slug(slug)) authz.require(authz.project_manage(project)) data = request_data({'author': request.account}) project = projects.save(data, project=project) db.session.commit() return jsonify(projects.to_rest(project))
def view(slug): project = object_or_404(Project.by_slug(slug)) validate_cache(last_modified=project.updated_at) return jsonify(projects.to_rest(project))
def create(): authz.require(authz.project_create()) project = projects.save(request_data({'author': request.account})) db.session.commit() return jsonify(projects.to_rest(project), status=201)
def view(slug): project = object_or_404(Project.by_slug(slug)) authz.require(authz.project_read(project)) if not project.private: validate_cache(last_modified=project.updated_at) return jsonify(projects.to_rest(project))