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:
@@ -391,13 +391,11 @@ def expire_all_project_links(project_uuid):
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import bson.tz_util
|
||||
from pillar.api.utils import utcnow
|
||||
|
||||
files_collection = current_app.data.driver.db['files']
|
||||
|
||||
now = datetime.datetime.now(tz=bson.tz_util.utc)
|
||||
expires = now - datetime.timedelta(days=1)
|
||||
|
||||
expires = utcnow() - datetime.timedelta(days=1)
|
||||
result = files_collection.update_many(
|
||||
{'project': ObjectId(project_uuid)},
|
||||
{'$set': {'link_expires': expires}}
|
||||
|
Reference in New Issue
Block a user