Commit 01bf6a53 authored by Alexandre Moevi's avatar Alexandre Moevi

refactor(id): add random id when no id is sent

parent 4dbfde21
Pipeline #4506 passed with stage
in 2 minutes and 4 seconds
......@@ -18,6 +18,7 @@
# along with Canopsis. If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------
import uuid
from bottle import request
from pymongo.errors import PyMongoError
......@@ -101,6 +102,9 @@ def exports(ws):
return gen_json_error(
{'description': 'Nothing to create'}, HTTP_ERROR)
if '_id' not in webhook:
webhook['_id'] = str(uuid.uuid4())
try:
return webhook_manager.create_webhook(webhook)
except CollectionError as ce:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment