Skip to content

Commit

Permalink
1) Ensure that eventlet's subprocess is used for Python versions up t…
Browse files Browse the repository at this point in the history
…o 3.11 and await the issue resolution for Python versions 3.12.

2) Fixed unescape sequence for Python 3.12
  • Loading branch information
akshay-joshi committed Nov 2, 2023
1 parent 5d70803 commit 9eb7c1c
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .pycodestyle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pycodestyle]
ignore = E402,W504,W605,E231,W605
ignore = E402,W504,E231
max-line-length = 79
statistics = True
show-source = False
Expand Down
2 changes: 2 additions & 0 deletions docs/en_US/release_notes_7_9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ New features
Housekeeping
************

| `Issue #6441 <https://github.com/pgadmin-org/pgadmin4/issues/6441>`_ - Update app bundle built to use notarytool instead of altool.
| `Issue #6479 <https://github.com/pgadmin-org/pgadmin4/issues/6479>`_ - Replace the current layout library wcDocker with ReactJS based rc-dock.
Bug fixes
*********

| `Issue #2986 <https://github.com/pgadmin-org/pgadmin4/issues/2986>`_ - Fix an issue where the scroll position of panels was not remembered on Firefox.
| `Issue #5807 <https://github.com/pgadmin-org/pgadmin4/issues/5807>`_ - Fixed an issue where psql was not taking the role used to connect in server properties.
| `Issue #6459 <https://github.com/pgadmin-org/pgadmin4/issues/6459>`_ - Fix the sorting of size on the statistics panel.
| `Issue #6487 <https://github.com/pgadmin-org/pgadmin4/issues/6487>`_ - Fixed restoration of query tool database connection after dropping and re-creating the database with the same name.
| `Issue #6602 <https://github.com/pgadmin-org/pgadmin4/issues/6602>`_ - Fix an issue where the default server-group is being deleted if the load-server json file contains no servers.
Expand Down
2 changes: 1 addition & 1 deletion tools/sql_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"https://raw.githubusercontent.com/postgres/postgres/master/src/pl/"
"plpgsql/src/pl_scanner.c",
]
PG_CODES_REGEX = "PG_KEYWORD\(\"([a-z]*)\"[A-Z_, ]*\)"
PG_CODES_REGEX = r"PG_KEYWORD\(\"([a-z]*)\"[A-Z_, ]*\)"

PG_SQL_DOCS_URL = \
"https://www.postgresql.org/docs/current/sql-keywords-appendix.html"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def runTest(self):
orig_sql = json.loads(get_response.data.decode('utf-8'))

# Replace multiple spaces with one space and check the expected sql
sql = re.sub('\s+', ' ', orig_sql).strip()
sql = re.sub(r'\s+', ' ', orig_sql).strip()
expected_sql = '-- DOMAIN: {0}.{1} -- DROP DOMAIN IF EXISTS ' \
'{0}.{1}; CREATE DOMAIN {0}.{1} {2} ' \
'ALTER DOMAIN {0}.{1} OWNER' \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def runTest(self):
exec_sql = json.loads(exec_response.data.decode('utf-8'))

# Replace multiple spaces with one space and check the expected sql
sql = re.sub('\s+', ' ', exec_sql).strip()
sql = re.sub(r'\s+', ' ', exec_sql).strip()

# Verify the expected EXEC SQL
if self.server_type == "pg":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def get_inner(sql):
if sql is None:
return None
start = 0
start_position = re.search("\s+[is|as]+\s+", sql, flags=re.I)
start_position = re.search(r"\s+[is|as]+\s+", sql, flags=re.I)

if start_position:
start = start_position.start() + 4
Expand Down
12 changes: 8 additions & 4 deletions web/pgadmin/tools/psql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
import select
import struct
import config
import subprocess
import sys
if sys.version_info >= (3, 12):
import subprocess
else:
from eventlet.green import subprocess
import re
from sys import platform as _platform
from config import PG_DEFAULT_DRIVER
Expand Down Expand Up @@ -391,8 +395,8 @@ def enter_key_press(data):
"""
user_input = data['input']

if user_input == '\q' or user_input == 'q\\q' or user_input in\
['\quit', 'exit', 'exit;']:
if user_input == r'\q' or user_input == 'q\\q' or user_input in\
[r'\quit', 'exit', 'exit;']:
# If user enter \q to terminate the PSQL, emit the msg to
# notify user connection is terminated.
sio.emit('pty-output',
Expand Down Expand Up @@ -553,7 +557,7 @@ def disconnect_socket():
process.terminate()
del app.config['sessions'][request.sid]
else:
os.write(app.config['sessions'][request.sid], '\q\n'.encode())
os.write(app.config['sessions'][request.sid], r'\q\n'.encode())
sio.sleep(1)
os.close(app.config['sessions'][request.sid])
os.close(cdata[request.sid])
Expand Down
4 changes: 2 additions & 2 deletions web/pgadmin/tools/sqleditor/tests/test_sql_ascii_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ class TestSQLASCIIEncoding(BaseTestGenerator):
table_name='test_sql_ascii',
db_encoding='SQL_ASCII',
lc_collate='C',
test_str='\\\\Four\\\Three\\Two\One'
test_str=r'\\\\Four\\\Three\\Two\One'
)),
(
'Test SQL_ASCII data with file path',
dict(
table_name='test_sql_ascii',
db_encoding='SQL_ASCII',
lc_collate='C',
test_str='\\test\Documents\2017\12\19\AD93E646-'
test_str=r'\\test\Documents\2017\12\19\AD93E646-'
'E5FE-11E7-85AE-EB2E217F96F0.tif'
)),
(
Expand Down
2 changes: 1 addition & 1 deletion web/regression/re_sql/tests/test_resql.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def preprocess_expected_sql(self, scenario, sql, resp_sql, object_id):
password = ''
for line in resp_sql.split('\n'):
if 'PASSWORD' in line:
found = re.search("'([\w\W]*)'", line)
found = re.search(r"'([\w\W]*)'", line)
if found:
password = found.groups(0)[0]
break
Expand Down

0 comments on commit 9eb7c1c

Please sign in to comment.