Added pillar.api.utils.utcnow() which returns a datetime for 'now'

This replaces pillar.web.utils.datetime_now() and can be used in a wider
setting (since we don't import web stuff in the api, but we do vice versa).
This commit is contained in:
2018-02-13 14:36:05 +01:00
parent d0520484bb
commit f2888069db
15 changed files with 41 additions and 52 deletions

View File

@@ -3,7 +3,7 @@ import json
import logging
import os
from bson import ObjectId, tz_util
from bson import ObjectId
from flask import Blueprint
from flask import abort
from flask import current_app
@@ -161,7 +161,7 @@ def zencoder_notifications():
file_doc['status'] = 'complete'
# Force an update of the links on the next load of the file.
file_doc['link_expires'] = datetime.datetime.now(tz=tz_util.utc) - datetime.timedelta(days=1)
file_doc['link_expires'] = utils.utcnow() - datetime.timedelta(days=1)
r, _, _, status = current_app.put_internal('files', file_doc, _id=file_id)
if status != 200: