mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
First round of Python 3 compatibility fixes.
This commit is contained in:
committed by
Dave Page
parent
da6043e7a5
commit
209ee78b25
@@ -12,7 +12,7 @@ from Crypto.Cipher import AES
|
||||
from Crypto import Random
|
||||
import base64
|
||||
|
||||
padding_string = '}'
|
||||
padding_string = b'}'
|
||||
|
||||
|
||||
def encrypt(plaintext, key):
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
from abc import ABCMeta, abstractmethod, abstractproperty
|
||||
from flask import session
|
||||
from .registry import DriverRegistry
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(DriverRegistry)
|
||||
class BaseDriver(object):
|
||||
"""
|
||||
class BaseDriver(object):
|
||||
@@ -40,7 +41,6 @@ class BaseDriver(object):
|
||||
session, which has not been pinged from more than the idle timeout
|
||||
configuration.
|
||||
"""
|
||||
__metaclass__ = DriverRegistry
|
||||
|
||||
@abstractproperty
|
||||
def Version(cls):
|
||||
@@ -58,7 +58,7 @@ class BaseDriver(object):
|
||||
def gc(self):
|
||||
pass
|
||||
|
||||
|
||||
@six.add_metaclass(ABCMeta)
|
||||
class BaseConnection(object):
|
||||
"""
|
||||
class BaseConnection(object)
|
||||
@@ -113,7 +113,6 @@ class BaseConnection(object):
|
||||
connection object for better memory management, and connection pool
|
||||
management.
|
||||
"""
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
@abstractmethod
|
||||
def connect(self, **kwargs):
|
||||
|
||||
@@ -111,9 +111,12 @@ class Connection(BaseConnection):
|
||||
)
|
||||
|
||||
except psycopg2.Error as e:
|
||||
msg = e.pgerror if e.pgerror else e.message \
|
||||
if e.message else e.diag.message_detail \
|
||||
if e.diag.message_detail else str(e)
|
||||
if e.pgerror:
|
||||
msg = e.pgerror
|
||||
elif e.diag.message_detail:
|
||||
msg = e.diag.message_detail
|
||||
else:
|
||||
msg = str(e)
|
||||
|
||||
return False, msg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user