feat: Deprecate datetime.utcnow() in favor of datetime.now(timezone.utc).replace(tzinfo=None) for better timezone handling (#3408) (#3416)
This commit is contained in:
parent
4d54637921
commit
c227f3d985
32 changed files with 112 additions and 112 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from typing import cast
|
||||
|
||||
import yaml
|
||||
|
|
@ -251,7 +251,7 @@ class AppService:
|
|||
app.description = args.get('description', '')
|
||||
app.icon = args.get('icon')
|
||||
app.icon_background = args.get('icon_background')
|
||||
app.updated_at = datetime.utcnow()
|
||||
app.updated_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
db.session.commit()
|
||||
|
||||
return app
|
||||
|
|
@ -264,7 +264,7 @@ class AppService:
|
|||
:return: App instance
|
||||
"""
|
||||
app.name = name
|
||||
app.updated_at = datetime.utcnow()
|
||||
app.updated_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
db.session.commit()
|
||||
|
||||
return app
|
||||
|
|
@ -279,7 +279,7 @@ class AppService:
|
|||
"""
|
||||
app.icon = icon
|
||||
app.icon_background = icon_background
|
||||
app.updated_at = datetime.utcnow()
|
||||
app.updated_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
db.session.commit()
|
||||
|
||||
return app
|
||||
|
|
@ -295,7 +295,7 @@ class AppService:
|
|||
return app
|
||||
|
||||
app.enable_site = enable_site
|
||||
app.updated_at = datetime.utcnow()
|
||||
app.updated_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
db.session.commit()
|
||||
|
||||
return app
|
||||
|
|
@ -311,7 +311,7 @@ class AppService:
|
|||
return app
|
||||
|
||||
app.enable_api = enable_api
|
||||
app.updated_at = datetime.utcnow()
|
||||
app.updated_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
db.session.commit()
|
||||
|
||||
return app
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue