def post_note(request): work = DBSession.query(Note).filter(Note.id == request.matchdict['nid']).first() if request.json.get('text', None): work.text = request.json['text'] work.modified_at = datetime.now() DBSession.add(work) DBSession.commit() return work.to_dict()
def put(self): DBSession.add(self) DBSession.flush()
def put_note(request): work = Note.from_dict(request.json) DBSession.add(work) DBSession.commit() return work.to_dict()