12345678910111213141516171819202122232425262728293031323334 |
- from flask import make_response, abort
- from flask.views import View, request
- from pycs import db
- from pycs.database.Project import Project
- from pycs.frontend.notifications.NotificationManager import NotificationManager
- class EditProjectDescription(View):
- """
- edit a projects description
- """
- # pylint: disable=arguments-differ
- methods = ['POST']
- def dispatch_request(self, identifier):
- # extract request data
- data = request.get_json(force=True)
- if 'description' not in data or not data['description']:
- return abort(400)
- with db.session.begin_nested():
- # find project
- project = Project.query.get(identifier)
- if project is None:
- return abort(404)
- # set description
- project.set_description(data['description'])
- NotificationManager.edited("project", project.id, Project)
- return make_response()
|