mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Remove old Python 2 compatibility code. Fixes #5700
This commit is contained in:
@@ -366,13 +366,6 @@ class Driver(BaseDriver):
|
||||
|
||||
if len(val) == 0:
|
||||
continue
|
||||
if hasattr(str, 'decode') and not isinstance(val, unicode):
|
||||
# Handling for python2
|
||||
try:
|
||||
val = str(val).encode('utf-8')
|
||||
except UnicodeDecodeError:
|
||||
# If already unicode, most likely coming from db
|
||||
val = str(val).decode('utf-8')
|
||||
value = val
|
||||
|
||||
if Driver.needsQuoting(val, True):
|
||||
@@ -398,14 +391,6 @@ class Driver(BaseDriver):
|
||||
if not hasattr(val, '__len__'):
|
||||
val = str(val)
|
||||
|
||||
if hasattr(str, 'decode') and not isinstance(val, unicode):
|
||||
# Handling for python2
|
||||
try:
|
||||
val = str(val).encode('utf-8')
|
||||
except UnicodeDecodeError:
|
||||
# If already unicode, most likely coming from db
|
||||
val = str(val).decode('utf-8')
|
||||
|
||||
if len(val) == 0:
|
||||
continue
|
||||
|
||||
|
@@ -15,7 +15,6 @@ object.
|
||||
|
||||
import random
|
||||
import select
|
||||
import six
|
||||
import datetime
|
||||
from collections import deque
|
||||
import psycopg2
|
||||
@@ -628,7 +627,7 @@ WHERE
|
||||
# "unicode_escape" will convert single backslash to double
|
||||
# backslash, so we will have to replace/revert them again
|
||||
# to store the correct value into the database.
|
||||
if isinstance(val, six.string_types):
|
||||
if isinstance(val, str):
|
||||
modified_val = val.encode('unicode_escape')\
|
||||
.decode('raw_unicode_escape')\
|
||||
.replace("\\\\", "\\")
|
||||
|
@@ -175,9 +175,6 @@ class ServerManager(object):
|
||||
async_=None, use_binary_placeholder=False, array_to_string=False
|
||||
):
|
||||
if database is not None:
|
||||
if hasattr(str, 'decode') and \
|
||||
not isinstance(database, unicode):
|
||||
database = database.decode('utf-8')
|
||||
if did is not None and did in self.db_info:
|
||||
self.db_info[did]['datname'] = database
|
||||
else:
|
||||
|
Reference in New Issue
Block a user