Added check if the Windows version is not supporting the ConPty or WinPty disable the PSQL for that version.

refs #2341
This commit is contained in:
Nikhil Mohite
2021-06-14 11:45:54 +05:30
committed by Akshay Joshi
parent dcaeb20e29
commit 09693d14d1
6 changed files with 51 additions and 39 deletions

View File

@@ -10,6 +10,10 @@ PSQL tool allows user to connect to PostgreSQL/EDB Advanced server using psql te
* PSQL will connect to the current connected database from browser tree. * PSQL will connect to the current connected database from browser tree.
* PSQL utility does support execution of OS meta-commands by using "\\!". Due
to security concerns, we have disabled the execution of such commands in
pgAdmin. To enable OS meta-commands set ALLOW_PSQL_SHELL_COMMANDS = True in configuration.
.. image:: images/psql_tool.png .. image:: images/psql_tool.png
:alt: PSQL tool window :alt: PSQL tool window
:align: center :align: center
@@ -17,3 +21,5 @@ PSQL tool allows user to connect to PostgreSQL/EDB Advanced server using psql te
You can open multiple instance of the PSQL tool in individual tabs simultaneously. You can open multiple instance of the PSQL tool in individual tabs simultaneously.
To close the PSQL tool, click the *X* in the upper-right hand corner of the tab bar. To close the PSQL tool, click the *X* in the upper-right hand corner of the tab bar.
**Note:** For the Windows platform, this feature is available on Windows 10 (1809 version) and onwards.

View File

@@ -60,7 +60,7 @@ winreg = None
if os.name == 'nt': if os.name == 'nt':
import winreg import winreg
socketio = SocketIO(manage_session=False, async_mode='eventlet', socketio = SocketIO(manage_session=False, async_mode='threading',
logger=False, engineio_logger=False, debug=False, logger=False, engineio_logger=False, debug=False,
ping_interval=25, ping_timeout=120) ping_interval=25, ping_timeout=120)

View File

@@ -855,7 +855,8 @@ def utils():
support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL, support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL,
logout_url=_get_logout_url(), logout_url=_get_logout_url(),
platform=sys.platform, platform=sys.platform,
qt_default_placeholder=QT_DEFAULT_PLACEHOLDER qt_default_placeholder=QT_DEFAULT_PLACEHOLDER,
enable_psql=config.ENABLE_PSQL
), ),
200, {'Content-Type': MIMETYPE_APP_JS}) 200, {'Content-Type': MIMETYPE_APP_JS})

View File

@@ -505,7 +505,7 @@ def register_browser_preferences(self):
' revert back to the default title with placeholders.' ' revert back to the default title with placeholders.'
) )
) )
if config.ENABLE_PSQL:
self.open_in_new_tab = self.preference.register( self.open_in_new_tab = self.preference.register(
'tab_settings', 'new_browser_tab_open', 'tab_settings', 'new_browser_tab_open',
gettext("Open in new browser tab"), 'select2', None, gettext("Open in new browser tab"), 'select2', None,

View File

@@ -53,7 +53,7 @@ define('pgadmin.browser.utils',
pgAdmin['override_user_inactivity_timeout'] = '{{ current_app.config.get('OVERRIDE_USER_INACTIVITY_TIMEOUT') }}' == 'True'; pgAdmin['override_user_inactivity_timeout'] = '{{ current_app.config.get('OVERRIDE_USER_INACTIVITY_TIMEOUT') }}' == 'True';
/* GET PSQL Tool related config */ /* GET PSQL Tool related config */
pgAdmin['enable_psql'] = '{{ current_app.config.get('ENABLE_PSQL') }}' == 'True'; pgAdmin['enable_psql'] = '{{enable_psql}}' == 'True';
pgAdmin['allow_psql_shell_commands'] = '{{ current_app.config.get('ALLOW_PSQL_SHELL_COMMANDS') }}' == 'True'; pgAdmin['allow_psql_shell_commands'] = '{{ current_app.config.get('ALLOW_PSQL_SHELL_COMMANDS') }}' == 'True';
pgAdmin['platform'] = '{{platform}}'; pgAdmin['platform'] = '{{platform}}';
pgAdmin['qt_default_placeholder'] = '{{qt_default_placeholder}}' pgAdmin['qt_default_placeholder'] = '{{qt_default_placeholder}}'

View File

@@ -20,7 +20,12 @@ from ... import socketio as sio
from pgadmin.utils import get_complete_file_path from pgadmin.utils import get_complete_file_path
if _platform == 'win32': if _platform == 'win32':
# Check Windows platform support for WinPty api, Disable psql
# if not supporting
try:
from winpty import PtyProcess from winpty import PtyProcess
except ImportError as error:
config.ENABLE_PSQL = False
else: else:
import fcntl import fcntl
import termios import termios