1) Replace utcnow() function with datetime.now(timezone.utc) as it is deprecated from Python v3.12.
2) Correct the URL to log an issue in pgAdmin in the ERD tool script.pull/6823/head
parent
6062084128
commit
5f3965ff0a
|
|
@ -33,7 +33,7 @@ OUTDIR - Output directory
|
|||
# To make print function compatible with python2 & python3
|
||||
import sys
|
||||
import os
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
from datetime import datetime, timedelta, tzinfo, timezone
|
||||
from subprocess import Popen, PIPE
|
||||
from threading import Thread
|
||||
import signal
|
||||
|
|
@ -133,9 +133,7 @@ class UTC(tzinfo):
|
|||
|
||||
|
||||
def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'):
|
||||
return datetime.utcnow().replace(
|
||||
tzinfo=UTC()
|
||||
).strftime(format)
|
||||
return datetime.now(timezone.utc).strftime(format)
|
||||
|
||||
|
||||
class ProcessLogger(Thread):
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import os
|
|||
import sys
|
||||
import psutil
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from pickle import dumps, loads
|
||||
from subprocess import Popen, PIPE
|
||||
import logging
|
||||
|
|
@ -29,7 +29,6 @@ from pgadmin.utils.constants import KERBEROS
|
|||
from pgadmin.utils.locker import ConnectionLocker
|
||||
from pgadmin.utils.preferences import Preferences
|
||||
|
||||
import pytz
|
||||
from dateutil import parser
|
||||
from flask import current_app, session
|
||||
from flask_babel import gettext as _
|
||||
|
|
@ -50,9 +49,7 @@ def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'):
|
|||
"""
|
||||
Generate the current time string in the given format.
|
||||
"""
|
||||
return datetime.utcnow().replace(
|
||||
tzinfo=pytz.utc
|
||||
).strftime(format)
|
||||
return datetime.now(timezone.utc).strftime(format)
|
||||
|
||||
|
||||
class IProcessDesc(metaclass=ABCMeta):
|
||||
|
|
|
|||
|
|
@ -668,7 +668,7 @@ class ERDTool extends React.Component {
|
|||
|
||||
onSQLClick(sqlWithDrop=false) {
|
||||
let scriptHeader = gettext('-- This script was generated by the ERD tool in pgAdmin 4.\n');
|
||||
scriptHeader += gettext('-- Please log an issue at https://redmine.postgresql.org/projects/pgadmin4/issues/new if you find any bugs, including reproduction steps.\n');
|
||||
scriptHeader += gettext('-- Please log an issue at https://github.com/pgadmin-org/pgadmin4/issues/new/choose if you find any bugs, including reproduction steps.\n');
|
||||
|
||||
let url = url_for('erd.sql', {
|
||||
trans_id: this.props.params.trans_id,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
# pgAdmin 4 - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL License
|
||||
#
|
||||
##########################################################################
|
||||
import logging
|
||||
import subprocess
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from threading import Lock
|
||||
|
||||
from flask import current_app
|
||||
|
|
@ -31,7 +37,7 @@ class PasswordExec:
|
|||
if not self.cmd:
|
||||
return None
|
||||
current_app.logger.info('Calling passexec')
|
||||
now = datetime.utcnow()
|
||||
now = datetime.now(timezone.utc)
|
||||
try:
|
||||
p = subprocess.run(
|
||||
self.cmd,
|
||||
|
|
@ -55,7 +61,7 @@ class PasswordExec:
|
|||
if self.expiration_seconds is None:
|
||||
return False
|
||||
return self.last_result is not None and\
|
||||
datetime.utcnow() - self.last_result \
|
||||
datetime.now(timezone.utc) - self.last_result \
|
||||
>= timedelta(seconds=self.expiration_seconds)
|
||||
|
||||
def create_logger(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue