diff options
Diffstat (limited to 'isso/views/comments.py')
-rw-r--r-- | isso/views/comments.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/isso/views/comments.py b/isso/views/comments.py index 0272fa3..c0b03c6 100644 --- a/isso/views/comments.py +++ b/isso/views/comments.py @@ -89,7 +89,8 @@ class API(object): ('moderate',('POST', '/id/<int:id>/<any(activate,delete):action>/<string:key>')), ('like', ('POST', '/id/<int:id>/like')), ('dislike', ('POST', '/id/<int:id>/dislike')), - ('demo', ('GET', '/demo')) + ('demo', ('GET', '/demo')), + ('preview', ('POST', '/preview')) ] def __init__(self, isso, hasher): @@ -476,5 +477,13 @@ class API(object): return JSON(self.comments.count(*data), 200) + def preview(self, environment, request): + data = request.get_json() + + if "text" not in data or data["text"] is None: + raise BadRequest("no text given") + + return JSON({'text': self.isso.render(data["text"])}, 200) + def demo(self, env, req): return redirect(get_current_url(env) + '/index.html') |