|
|
|
@ -45,7 +45,6 @@ def create(app, environ, request, uri):
|
|
|
|
|
try:
|
|
|
|
|
comment = models.Comment.fromjson(request.data)
|
|
|
|
|
except ValueError as e:
|
|
|
|
|
print(1)
|
|
|
|
|
return Response(unicode(e), 400)
|
|
|
|
|
|
|
|
|
|
for attr in 'author', 'email', 'website':
|
|
|
|
@ -53,13 +52,11 @@ def create(app, environ, request, uri):
|
|
|
|
|
try:
|
|
|
|
|
setattr(comment, attr, cgi.escape(getattr(comment, attr)))
|
|
|
|
|
except AttributeError:
|
|
|
|
|
print(1)
|
|
|
|
|
Response('', 400)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
rv = app.db.add(uri, comment)
|
|
|
|
|
except ValueError:
|
|
|
|
|
print(1)
|
|
|
|
|
abort(400) # FIXME: custom exception class, error descr
|
|
|
|
|
|
|
|
|
|
md5 = rv.md5
|
|
|
|
|