Exemplo n.º 1
0
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()
Exemplo n.º 2
0
 def put(self):
     DBSession.add(self)
     DBSession.flush()
Exemplo n.º 3
0
def put_note(request):
    work = Note.from_dict(request.json)
    DBSession.add(work)
    DBSession.commit()
    return work.to_dict()