summaryrefslogtreecommitdiff
path: root/archivist/server/tag.py
diff options
context:
space:
mode:
Diffstat (limited to 'archivist/server/tag.py')
-rw-r--r--archivist/server/tag.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/archivist/server/tag.py b/archivist/server/tag.py
index 8142cd1..4573c55 100644
--- a/archivist/server/tag.py
+++ b/archivist/server/tag.py
@@ -1,6 +1,8 @@
from flask import request
from flask_restplus import Resource, fields, Namespace
+from http import HTTPStatus
+
from .. import model as m
from .. import bl
@@ -21,13 +23,13 @@ class TagList(Resource):
return list(m.Tag.select().where(~m.Tag.default).dicts().iterator())
@api.expect(tag, validate=True)
- @api.response(201, "Tag created")
- @api.response(409, "Tag already exists")
+ @api.response(HTTPStatus.CREATED, "Tag created")
+ @api.response(HTTPStatus.CONFLICT, "Tag already exists")
def put(self):
"""Create a new tag."""
data = request.get_json()
tag, created = bl.PrefixTag(**data).create()
if created:
- return '',201
+ return '', HTTPStatus.CREATED
else:
- return '',409
+ return '', HTTPStatus.CONFLICT