Skip to content

Commit

Permalink
Replace deprecated datetime.utcnow
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Dec 13, 2023
1 parent 0f080fc commit befa3bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/controllers/controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
import datetime
import math

from flask import abort, flash, redirect, render_template, request, url_for
Expand Down Expand Up @@ -427,7 +427,7 @@ def update_config_timestamp(self, session):
session.add(last_update)

# update and commit new timestamp
last_update.updated_at = datetime.utcnow()
last_update.updated_at = datetime.datetime.now(datetime.UTC)
session.commit()

def update_form_collection(
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/config_editor/controllers/configs_controller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import OrderedDict
from datetime import datetime
import datetime
import os
from shutil import copyfile

Expand Down Expand Up @@ -186,7 +186,7 @@ def save_json_config_file(self, config_data, file_name):

# save backup of current config file
# as '<file_name>-YYYYmmdd-HHMMSS.bak'
timestamp = datetime.utcnow().strftime("%Y%m%d-%H%M%S")
timestamp = datetime.datetime.now(datetime.UTC).strftime("%Y%m%d-%H%M%S")
backup_file_name = "%s-%s.bak" % (file_name, timestamp)
backup_file_path = os.path.join(config_path, backup_file_name)
self.logger.info(
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/themes/utils/themes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import json
import pathlib
from datetime import datetime
import datetime
from collections import OrderedDict
from urllib.parse import urlparse

Expand Down Expand Up @@ -63,7 +63,7 @@ def save_themesconfig(new_themes_config, app, handler):
e.strerror))
return False

baksuffix = "%s.bak" % datetime.utcnow().strftime("-%Y%m%d-%H%M%S")
baksuffix = "%s.bak" % datetime.datetime.now(datetime.UTC).strftime("-%Y%m%d-%H%M%S")
themes_config = tenant_config.get("themesConfig", None)

if isinstance(themes_config, str):
Expand Down Expand Up @@ -143,7 +143,7 @@ def save_featureinfo_config(new_featureinfo_config, app, handler):
app.logger.error("Error reading tenantConfig.json: {}".format(e.strerror))
return False

baksuffix = "%s.bak" % datetime.utcnow().strftime("-%Y%m%d-%H%M%S")
baksuffix = "%s.bak" % datetime.datetime.now(datetime.UTC).strftime("-%Y%m%d-%H%M%S")
services = tenant_config.get("services", [])

for service in services:
Expand Down

0 comments on commit befa3bd

Please sign in to comment.