def save_synthesis(request):
synthesis_id = request.matchdict['id']
discussion = request.context
if synthesis_id == 'next_synthesis':
synthesis = discussion.get_next_synthesis()
else:
synthesis = Synthesis.get_instance(synthesis_id)
if not synthesis:
raise HTTPBadRequest("Synthesis with id '%s' not found." % synthesis_id)
synthesis_data = json.loads(request.body)
synthesis.subject = synthesis_data.get('subject')
synthesis.introduction = synthesis_data.get('introduction')
synthesis.conclusion = synthesis_data.get('conclusion')
Synthesis.default_db.add(synthesis)
Synthesis.default_db.flush()
return {'ok': True, 'id': synthesis.uri()}
评论列表
文章目录