mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed code smell 'String literals should not be duplicated'.
This commit is contained in:
committed by
Akshay Joshi
parent
e226b2fa75
commit
3984544bdb
@@ -23,7 +23,7 @@ from pgadmin.tools.sqleditor.utils.save_changed_data import save_changed_data
|
||||
from pgadmin.tools.sqleditor.utils.get_column_types import get_columns_types
|
||||
from pgadmin.utils.preferences import Preferences
|
||||
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||
|
||||
from pgadmin.utils.constants import SERVER_CONNECTION_CLOSED
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
|
||||
VIEW_FIRST_100_ROWS = 1
|
||||
@@ -196,10 +196,7 @@ class SQLFilter(object):
|
||||
self.nsp_name = result['rows'][0]['nspname']
|
||||
self.object_name = result['rows'][0]['relname']
|
||||
else:
|
||||
raise InternalServerError(gettext(
|
||||
'Not connected to server or connection with the server '
|
||||
'has been closed.')
|
||||
)
|
||||
raise InternalServerError(SERVER_CONNECTION_CLOSED)
|
||||
|
||||
def get_filter(self):
|
||||
"""
|
||||
@@ -407,10 +404,8 @@ class GridCommand(BaseCommand, SQLFilter, FetchedRowTracker):
|
||||
for row in result['rows']:
|
||||
all_columns.append(row['attname'])
|
||||
else:
|
||||
raise InternalServerError(
|
||||
gettext('Not connected to server or connection with the '
|
||||
'server has been closed.')
|
||||
)
|
||||
raise InternalServerError(SERVER_CONNECTION_CLOSED)
|
||||
|
||||
# If user has custom data sorting then pass as it as it is
|
||||
if data_sorting and len(data_sorting) > 0:
|
||||
all_sorted_columns = data_sorting
|
||||
@@ -553,10 +548,7 @@ class TableCommand(GridCommand):
|
||||
# Remove last character from the string
|
||||
pk_names = pk_names[:-1]
|
||||
else:
|
||||
raise InternalServerError(
|
||||
gettext('Not connected to server or connection with the '
|
||||
'server has been closed.')
|
||||
)
|
||||
raise InternalServerError(SERVER_CONNECTION_CLOSED)
|
||||
|
||||
return pk_names, primary_keys
|
||||
|
||||
@@ -650,10 +642,7 @@ class TableCommand(GridCommand):
|
||||
raise ExecuteError(has_oids)
|
||||
|
||||
else:
|
||||
raise InternalServerError(
|
||||
gettext('Not connected to server or connection with the '
|
||||
'server has been closed.')
|
||||
)
|
||||
raise InternalServerError(SERVER_CONNECTION_CLOSED)
|
||||
|
||||
return has_oids
|
||||
|
||||
@@ -1002,7 +991,4 @@ class QueryToolCommand(BaseCommand, FetchedRowTracker):
|
||||
self.nsp_name = result['rows'][0]['nspname']
|
||||
self.object_name = result['rows'][0]['relname']
|
||||
else:
|
||||
raise InternalServerError(gettext(
|
||||
'Not connected to server or connection with the server '
|
||||
'has been closed.')
|
||||
)
|
||||
raise InternalServerError(SERVER_CONNECTION_CLOSED)
|
||||
|
||||
Reference in New Issue
Block a user