modify can return plain text and marked up content
This commit is contained in:
parent
ba631eaa57
commit
b4708fb284
@ -51,6 +51,7 @@ def get(app, environ, request, path, id=None):
|
|||||||
if not rv:
|
if not rv:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
if request.args.get('plain', '0') == '0':
|
||||||
if isinstance(rv, list):
|
if isinstance(rv, list):
|
||||||
for item in rv:
|
for item in rv:
|
||||||
item.text = app.markup.convert(item.text)
|
item.text = app.markup.convert(item.text)
|
||||||
@ -77,6 +78,7 @@ def modify(app, environ, request, path, id):
|
|||||||
if request.method == 'PUT':
|
if request.method == 'PUT':
|
||||||
try:
|
try:
|
||||||
rv = app.db.update(path, id, models.Comment.fromjson(request.data))
|
rv = app.db.update(path, id, models.Comment.fromjson(request.data))
|
||||||
|
rv.text = app.markup.convert(rv.text)
|
||||||
return Response(json.dumps(rv), 200, content_type='application/json')
|
return Response(json.dumps(rv), 200, content_type='application/json')
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return Response(unicode(e), 400)
|
return Response(unicode(e), 400)
|
||||||
|
Loading…
Reference in New Issue
Block a user