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:
parent
974d395a48
commit
31bbdd6a12
@ -19,6 +19,10 @@ from pgadmin.browser.collection import CollectionNodeModule
|
|||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.driver import get_driver
|
from pgadmin.utils.driver import get_driver
|
||||||
from config import PG_DEFAULT_DRIVER
|
from config import PG_DEFAULT_DRIVER
|
||||||
|
from pgadmin.utils.constants import DATATYPE_TIME_WITH_TIMEZONE,\
|
||||||
|
DATATYPE_TIME_WITHOUT_TIMEZONE,\
|
||||||
|
DATATYPE_TIMESTAMP_WITH_TIMEZONE,\
|
||||||
|
DATATYPE_TIMESTAMP_WITHOUT_TIMEZONE
|
||||||
|
|
||||||
|
|
||||||
class SchemaChildModule(CollectionNodeModule):
|
class SchemaChildModule(CollectionNodeModule):
|
||||||
@ -205,20 +209,22 @@ class DataTypeReader:
|
|||||||
1014, 'bpchar[]', 'character[]',
|
1014, 'bpchar[]', 'character[]',
|
||||||
1015, 'varchar[]', 'character varying[]'):
|
1015, 'varchar[]', 'character varying[]'):
|
||||||
typeval = 'L'
|
typeval = 'L'
|
||||||
elif elemoid_or_name in (1083, 'time', 'time without time zone',
|
elif elemoid_or_name in (1083, 'time',
|
||||||
|
DATATYPE_TIME_WITHOUT_TIMEZONE,
|
||||||
1114, 'timestamp',
|
1114, 'timestamp',
|
||||||
'timestamp without time zone',
|
DATATYPE_TIMESTAMP_WITHOUT_TIMEZONE,
|
||||||
1115, 'timestamp[]',
|
1115, 'timestamp[]',
|
||||||
'timestamp without time zone[]',
|
'timestamp without time zone[]',
|
||||||
1183, 'time[]',
|
1183, 'time[]',
|
||||||
'time without time zone[]',
|
'time without time zone[]',
|
||||||
1184, 'timestamptz',
|
1184, 'timestamptz',
|
||||||
'timestamp with time zone',
|
DATATYPE_TIMESTAMP_WITH_TIMEZONE,
|
||||||
1185, 'timestamptz[]',
|
1185, 'timestamptz[]',
|
||||||
'timestamp with time zone[]',
|
'timestamp with time zone[]',
|
||||||
1186, 'interval',
|
1186, 'interval',
|
||||||
1187, 'interval[]', 'interval[]',
|
1187, 'interval[]', 'interval[]',
|
||||||
1266, 'timetz', 'time with time zone',
|
1266, 'timetz',
|
||||||
|
DATATYPE_TIME_WITH_TIMEZONE,
|
||||||
1270, 'timetz', 'time with time zone[]'):
|
1270, 'timetz', 'time with time zone[]'):
|
||||||
typeval = 'D'
|
typeval = 'D'
|
||||||
elif elemoid_or_name in (1231, 'numeric[]',
|
elif elemoid_or_name in (1231, 'numeric[]',
|
||||||
@ -254,12 +260,12 @@ class DataTypeReader:
|
|||||||
elif (
|
elif (
|
||||||
name == 'time' or
|
name == 'time' or
|
||||||
name == 'timetz' or
|
name == 'timetz' or
|
||||||
name == 'time without time zone' or
|
name == DATATYPE_TIME_WITHOUT_TIMEZONE or
|
||||||
name == 'time with time zone' or
|
name == DATATYPE_TIME_WITH_TIMEZONE or
|
||||||
name == 'timestamp' or
|
name == 'timestamp' or
|
||||||
name == 'timestamptz' or
|
name == 'timestamptz' or
|
||||||
name == 'timestamp without time zone' or
|
name == DATATYPE_TIMESTAMP_WITHOUT_TIMEZONE or
|
||||||
name == 'timestamp with time zone' or
|
name == DATATYPE_TIMESTAMP_WITH_TIMEZONE or
|
||||||
name == 'bit' or
|
name == 'bit' or
|
||||||
name == 'bit varying' or
|
name == 'bit varying' or
|
||||||
name == 'varbit'
|
name == 'varbit'
|
||||||
@ -300,13 +306,13 @@ class DataTypeReader:
|
|||||||
"""
|
"""
|
||||||
if name == 'char' and schema == 'pg_catalog':
|
if name == 'char' and schema == 'pg_catalog':
|
||||||
return '"char"' + array
|
return '"char"' + array
|
||||||
elif name == 'time with time zone':
|
elif name == DATATYPE_TIME_WITH_TIMEZONE:
|
||||||
return 'time' + length + ' with time zone' + array
|
return 'time' + length + ' with time zone' + array
|
||||||
elif name == 'time without time zone':
|
elif name == DATATYPE_TIME_WITHOUT_TIMEZONE:
|
||||||
return 'time' + length + ' without time zone' + array
|
return 'time' + length + ' without time zone' + array
|
||||||
elif name == 'timestamp with time zone':
|
elif name == DATATYPE_TIMESTAMP_WITH_TIMEZONE:
|
||||||
return 'timestamp' + length + ' with time zone' + array
|
return 'timestamp' + length + ' with time zone' + array
|
||||||
elif name == 'timestamp without time zone':
|
elif name == DATATYPE_TIMESTAMP_WITHOUT_TIMEZONE:
|
||||||
return 'timestamp' + length + ' without time zone' + array
|
return 'timestamp' + length + ' without time zone' + array
|
||||||
else:
|
else:
|
||||||
return name + length + array
|
return name + length + array
|
||||||
|
@ -557,10 +557,9 @@ class Filemanager(object):
|
|||||||
Filemanager.check_access_permission(in_dir, path)
|
Filemanager.check_access_permission(in_dir, path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Filemanager.resume_windows_warning()
|
Filemanager.resume_windows_warning()
|
||||||
err_msg = gettext("Error: {0}").format(e)
|
|
||||||
files = {
|
files = {
|
||||||
'Code': 0,
|
'Code': 0,
|
||||||
'Error': err_msg
|
'Error': str(e)
|
||||||
}
|
}
|
||||||
return files
|
return files
|
||||||
|
|
||||||
@ -660,9 +659,9 @@ class Filemanager(object):
|
|||||||
Filemanager.resume_windows_warning()
|
Filemanager.resume_windows_warning()
|
||||||
if (hasattr(e, 'strerror') and
|
if (hasattr(e, 'strerror') and
|
||||||
e.strerror == gettext('Permission denied')):
|
e.strerror == gettext('Permission denied')):
|
||||||
err_msg = gettext("Error: {0}").format(e.strerror)
|
err_msg = str(e.strerror)
|
||||||
else:
|
else:
|
||||||
err_msg = gettext("Error: {0}").format(e)
|
err_msg = str(e)
|
||||||
files = {
|
files = {
|
||||||
'Code': 0,
|
'Code': 0,
|
||||||
'Error': err_msg
|
'Error': err_msg
|
||||||
@ -751,7 +750,7 @@ class Filemanager(object):
|
|||||||
'Filename': split_path(path)[-1],
|
'Filename': split_path(path)[-1],
|
||||||
'FileType': '',
|
'FileType': '',
|
||||||
'Path': path,
|
'Path': path,
|
||||||
'Error': gettext("Error: {0}").format(e),
|
'Error': str(e),
|
||||||
'Code': 0,
|
'Code': 0,
|
||||||
'Info': '',
|
'Info': '',
|
||||||
'Properties': {
|
'Properties': {
|
||||||
@ -835,7 +834,7 @@ class Filemanager(object):
|
|||||||
Filemanager.check_access_permission(the_dir, new)
|
Filemanager.check_access_permission(the_dir, new)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {
|
res = {
|
||||||
'Error': gettext("Error: {0}").format(e),
|
'Error': str(e),
|
||||||
'Code': 0
|
'Code': 0
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
@ -896,7 +895,7 @@ class Filemanager(object):
|
|||||||
Filemanager.check_access_permission(the_dir, path)
|
Filemanager.check_access_permission(the_dir, path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {
|
res = {
|
||||||
'Error': gettext("Error: {0}").format(e),
|
'Error': str(e),
|
||||||
'Code': 0
|
'Code': 0
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
@ -910,7 +909,7 @@ class Filemanager(object):
|
|||||||
os.remove(orig_path)
|
os.remove(orig_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
code = 0
|
code = 0
|
||||||
err_msg = gettext("Error: {0}").format(e.strerror)
|
err_msg = str(e.strerror)
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'Path': path,
|
'Path': path,
|
||||||
@ -950,14 +949,13 @@ class Filemanager(object):
|
|||||||
f.write(data)
|
f.write(data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
code = 0
|
code = 0
|
||||||
err_msg = gettext("Error: {0}").format(
|
err_msg = str(e.strerror) if hasattr(e, 'strerror') else str(e)
|
||||||
e.strerror if hasattr(e, 'strerror') else gettext('Unknown'))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Filemanager.check_access_permission(the_dir, path)
|
Filemanager.check_access_permission(the_dir, path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {
|
res = {
|
||||||
'Error': gettext("Error: {0}").format(e),
|
'Error': str(e),
|
||||||
'Code': 0
|
'Code': 0
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
@ -991,9 +989,9 @@ class Filemanager(object):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
code = 0
|
code = 0
|
||||||
if hasattr(e, 'strerror'):
|
if hasattr(e, 'strerror'):
|
||||||
err_msg = gettext("Error: {0}").format(e.strerror)
|
err_msg = str(e.strerror)
|
||||||
else:
|
else:
|
||||||
err_msg = gettext("Error: {0}").format(e)
|
err_msg = str(e)
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'Path': path,
|
'Path': path,
|
||||||
@ -1083,13 +1081,13 @@ class Filemanager(object):
|
|||||||
# we don't want to expose real path of file
|
# we don't want to expose real path of file
|
||||||
# so only show error message.
|
# so only show error message.
|
||||||
if ex.strerror == 'Permission denied':
|
if ex.strerror == 'Permission denied':
|
||||||
err_msg = gettext("Error: {0}").format(ex.strerror)
|
err_msg = str(ex.strerror)
|
||||||
else:
|
else:
|
||||||
err_msg = gettext("Error: {0}").format(str(ex))
|
err_msg = str(ex)
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
status = False
|
status = False
|
||||||
err_msg = gettext("Error: {0}").format(str(ex))
|
err_msg = str(ex)
|
||||||
|
|
||||||
# Remove root storage path from error message
|
# Remove root storage path from error message
|
||||||
# when running in Server mode
|
# when running in Server mode
|
||||||
@ -1117,7 +1115,7 @@ class Filemanager(object):
|
|||||||
path, name))
|
path, name))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {
|
res = {
|
||||||
'Error': gettext("Error: {0}").format(e),
|
'Error': str(e),
|
||||||
'Code': 0
|
'Code': 0
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
@ -1135,14 +1133,14 @@ class Filemanager(object):
|
|||||||
os.mkdir(new_path)
|
os.mkdir(new_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
code = 0
|
code = 0
|
||||||
err_msg = gettext("Error: {0}").format(e.strerror)
|
err_msg = str(e.strerror)
|
||||||
else:
|
else:
|
||||||
new_path, new_name = self.get_new_name(the_dir, path, name)
|
new_path, new_name = self.get_new_name(the_dir, path, name)
|
||||||
try:
|
try:
|
||||||
os.mkdir(new_path)
|
os.mkdir(new_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
code = 0
|
code = 0
|
||||||
err_msg = gettext("Error: {0}").format(e.strerror)
|
err_msg = str(e.strerror)
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'Parent': path,
|
'Parent': path,
|
||||||
@ -1171,7 +1169,7 @@ class Filemanager(object):
|
|||||||
the_dir, "{}{}".format(path, path)
|
the_dir, "{}{}".format(path, path)
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
resp = Response(gettext("Error: {0}").format(e))
|
resp = Response(str(e))
|
||||||
resp.headers['Content-Disposition'] = \
|
resp.headers['Content-Disposition'] = \
|
||||||
'attachment; filename=' + name
|
'attachment; filename=' + name
|
||||||
return resp
|
return resp
|
||||||
@ -1188,7 +1186,7 @@ class Filemanager(object):
|
|||||||
try:
|
try:
|
||||||
Filemanager.check_access_permission(the_dir, path)
|
Filemanager.check_access_permission(the_dir, path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
err_msg = gettext("Error: {0}").format(e)
|
err_msg = str(e)
|
||||||
res['Code'] = 0
|
res['Code'] = 0
|
||||||
res['Error'] = err_msg
|
res['Error'] = err_msg
|
||||||
return res
|
return res
|
||||||
|
@ -26,7 +26,8 @@ from pgadmin.tools.schema_diff.model import SchemaDiffModel
|
|||||||
from config import PG_DEFAULT_DRIVER
|
from config import PG_DEFAULT_DRIVER
|
||||||
from pgadmin.utils.driver import get_driver
|
from pgadmin.utils.driver import get_driver
|
||||||
from pgadmin.utils.preferences import Preferences
|
from pgadmin.utils.preferences import Preferences
|
||||||
from pgadmin.utils.constants import PREF_LABEL_DISPLAY, MIMETYPE_APP_JS
|
from pgadmin.utils.constants import PREF_LABEL_DISPLAY, MIMETYPE_APP_JS,\
|
||||||
|
ERROR_MSG_TRANS_ID_NOT_FOUND
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import or_
|
||||||
|
|
||||||
MODULE_NAME = 'schema_diff'
|
MODULE_NAME = 'schema_diff'
|
||||||
@ -155,17 +156,13 @@ def check_transaction_status(trans_id):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if 'schemaDiff' not in session:
|
if 'schemaDiff' not in session:
|
||||||
return False, gettext(
|
return False, ERROR_MSG_TRANS_ID_NOT_FOUND, None, None
|
||||||
'Transaction ID not found in the session.'
|
|
||||||
), None, None
|
|
||||||
|
|
||||||
schema_diff_data = session['schemaDiff']
|
schema_diff_data = session['schemaDiff']
|
||||||
|
|
||||||
# Return from the function if transaction id not found
|
# Return from the function if transaction id not found
|
||||||
if str(trans_id) not in schema_diff_data:
|
if str(trans_id) not in schema_diff_data:
|
||||||
return False, gettext(
|
return False, ERROR_MSG_TRANS_ID_NOT_FOUND, None, None
|
||||||
'Transaction ID not found in the session.'
|
|
||||||
), None, None
|
|
||||||
|
|
||||||
# Fetch the object for the specified transaction id.
|
# Fetch the object for the specified transaction id.
|
||||||
# Use pickle.loads function to get the model object
|
# Use pickle.loads function to get the model object
|
||||||
@ -439,7 +436,7 @@ def compare(trans_id, source_sid, source_did, target_sid, target_did):
|
|||||||
status, error_msg, diff_model_obj, session_obj = \
|
status, error_msg, diff_model_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg, status=404)
|
return make_json_response(success=0, errormsg=error_msg, status=404)
|
||||||
|
|
||||||
# Server version compatibility check
|
# Server version compatibility check
|
||||||
@ -566,7 +563,7 @@ def poll(trans_id):
|
|||||||
status, error_msg, diff_model_obj, session_obj = \
|
status, error_msg, diff_model_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg, status=404)
|
return make_json_response(success=0, errormsg=error_msg, status=404)
|
||||||
|
|
||||||
msg, diff_percentage = diff_model_obj.get_comparison_info()
|
msg, diff_percentage = diff_model_obj.get_comparison_info()
|
||||||
@ -599,7 +596,7 @@ def ddl_compare(trans_id, source_sid, source_did, source_scid,
|
|||||||
status, error_msg, diff_model_obj, session_obj = \
|
status, error_msg, diff_model_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg, status=404)
|
return make_json_response(success=0, errormsg=error_msg, status=404)
|
||||||
|
|
||||||
view = SchemaDiffRegistry.get_node_view(node_type)
|
view = SchemaDiffRegistry.get_node_view(node_type)
|
||||||
|
@ -44,7 +44,8 @@ from pgadmin.tools.sqleditor.utils.query_tool_fs_utils import \
|
|||||||
read_file_generator
|
read_file_generator
|
||||||
from pgadmin.tools.sqleditor.utils.filter_dialog import FilterDialog
|
from pgadmin.tools.sqleditor.utils.filter_dialog import FilterDialog
|
||||||
from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
|
from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
|
||||||
from pgadmin.utils.constants import MIMETYPE_APP_JS, SERVER_CONNECTION_CLOSED
|
from pgadmin.utils.constants import MIMETYPE_APP_JS, SERVER_CONNECTION_CLOSED,\
|
||||||
|
ERROR_MSG_TRANS_ID_NOT_FOUND
|
||||||
|
|
||||||
MODULE_NAME = 'sqleditor'
|
MODULE_NAME = 'sqleditor'
|
||||||
|
|
||||||
@ -139,17 +140,13 @@ def check_transaction_status(trans_id):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if 'gridData' not in session:
|
if 'gridData' not in session:
|
||||||
return False, gettext(
|
return False, ERROR_MSG_TRANS_ID_NOT_FOUND, None, None, None
|
||||||
'Transaction ID not found in the session.'
|
|
||||||
), None, None, None
|
|
||||||
|
|
||||||
grid_data = session['gridData']
|
grid_data = session['gridData']
|
||||||
|
|
||||||
# Return from the function if transaction id not found
|
# Return from the function if transaction id not found
|
||||||
if str(trans_id) not in grid_data:
|
if str(trans_id) not in grid_data:
|
||||||
return False, gettext(
|
return False, ERROR_MSG_TRANS_ID_NOT_FOUND, None, None, None
|
||||||
'Transaction ID not found in the session.'
|
|
||||||
), None, None, None
|
|
||||||
|
|
||||||
# Fetch the object for the specified transaction id.
|
# Fetch the object for the specified transaction id.
|
||||||
# Use pickle.loads function to get the command object
|
# Use pickle.loads function to get the command object
|
||||||
@ -199,7 +196,7 @@ def start_view_data(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -345,7 +342,7 @@ def poll(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -531,7 +528,7 @@ def fetch(trans_id, fetch_all=None):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -677,7 +674,7 @@ def save(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -750,7 +747,7 @@ def append_filter_inclusive(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -805,7 +802,7 @@ def append_filter_exclusive(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -857,7 +854,7 @@ def remove_filter(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -901,7 +898,7 @@ def set_limit(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -984,7 +981,7 @@ def cancel_transaction(trans_id):
|
|||||||
if is_error:
|
if is_error:
|
||||||
return make_json_response(
|
return make_json_response(
|
||||||
success=0,
|
success=0,
|
||||||
errormsg=gettext('Transaction ID not found in the session.'),
|
errormsg=ERROR_MSG_TRANS_ID_NOT_FOUND,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED', status=404)
|
info='DATAGRID_TRANSACTION_REQUIRED', status=404)
|
||||||
|
|
||||||
# Fetch the object for the specified transaction id.
|
# Fetch the object for the specified transaction id.
|
||||||
@ -1043,7 +1040,7 @@ def get_object_name(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -1079,7 +1076,7 @@ def set_auto_commit(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -1124,7 +1121,7 @@ def set_auto_rollback(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
@ -1176,7 +1173,7 @@ def auto_complete(trans_id):
|
|||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
check_transaction_status(trans_id)
|
check_transaction_status(trans_id)
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(success=0, errormsg=error_msg,
|
return make_json_response(success=0, errormsg=error_msg,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404)
|
status=404)
|
||||||
|
@ -2071,7 +2071,7 @@ define('tools.querytool', [
|
|||||||
if(!pgWindow.default.pgAdmin.selected_tree_map)
|
if(!pgWindow.default.pgAdmin.selected_tree_map)
|
||||||
pgWindow.default.pgAdmin.selected_tree_map = new Map();
|
pgWindow.default.pgAdmin.selected_tree_map = new Map();
|
||||||
|
|
||||||
pgWindow.default.pgAdmin.selected_tree_map.set(d._id.toString(), selected_tree_node);
|
pgWindow.default.pgAdmin.selected_tree_map.set(d._pid.toString(), selected_tree_node);
|
||||||
};
|
};
|
||||||
|
|
||||||
_.extend(
|
_.extend(
|
||||||
|
@ -16,6 +16,7 @@ from pgadmin.utils.ajax import make_json_response, internal_server_error
|
|||||||
from pgadmin.tools.sqleditor.utils.update_session_grid_transaction import \
|
from pgadmin.tools.sqleditor.utils.update_session_grid_transaction import \
|
||||||
update_session_grid_transaction
|
update_session_grid_transaction
|
||||||
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost
|
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost
|
||||||
|
from pgadmin.utils.constants import ERROR_MSG_TRANS_ID_NOT_FOUND
|
||||||
|
|
||||||
|
|
||||||
class FilterDialog(object):
|
class FilterDialog(object):
|
||||||
@ -23,7 +24,7 @@ class FilterDialog(object):
|
|||||||
def get(*args):
|
def get(*args):
|
||||||
"""To fetch the current sorted columns"""
|
"""To fetch the current sorted columns"""
|
||||||
status, error_msg, conn, trans_obj, session_obj = args
|
status, error_msg, conn, trans_obj, session_obj = args
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(
|
return make_json_response(
|
||||||
success=0,
|
success=0,
|
||||||
errormsg=error_msg,
|
errormsg=error_msg,
|
||||||
@ -76,7 +77,7 @@ class FilterDialog(object):
|
|||||||
else:
|
else:
|
||||||
data = request.args or request.form
|
data = request.args or request.form
|
||||||
|
|
||||||
if error_msg == gettext('Transaction ID not found in the session.'):
|
if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:
|
||||||
return make_json_response(
|
return make_json_response(
|
||||||
success=0,
|
success=0,
|
||||||
errormsg=error_msg,
|
errormsg=error_msg,
|
||||||
|
@ -27,6 +27,7 @@ from pgadmin.utils.ajax import make_json_response, internal_server_error
|
|||||||
from pgadmin.utils.driver import get_driver
|
from pgadmin.utils.driver import get_driver
|
||||||
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost,\
|
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost,\
|
||||||
CryptKeyMissing
|
CryptKeyMissing
|
||||||
|
from pgadmin.utils.constants import ERROR_MSG_TRANS_ID_NOT_FOUND
|
||||||
|
|
||||||
|
|
||||||
class StartRunningQuery:
|
class StartRunningQuery:
|
||||||
@ -173,7 +174,7 @@ class StartRunningQuery:
|
|||||||
if 'gridData' not in http_session:
|
if 'gridData' not in http_session:
|
||||||
return make_json_response(
|
return make_json_response(
|
||||||
success=0,
|
success=0,
|
||||||
errormsg=gettext('Transaction ID not found in the session.'),
|
errormsg=ERROR_MSG_TRANS_ID_NOT_FOUND,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED', status=404
|
info='DATAGRID_TRANSACTION_REQUIRED', status=404
|
||||||
)
|
)
|
||||||
grid_data = http_session['gridData']
|
grid_data = http_session['gridData']
|
||||||
@ -181,7 +182,7 @@ class StartRunningQuery:
|
|||||||
if str(transaction_id) not in grid_data:
|
if str(transaction_id) not in grid_data:
|
||||||
return make_json_response(
|
return make_json_response(
|
||||||
success=0,
|
success=0,
|
||||||
errormsg=gettext('Transaction ID not found in the session.'),
|
errormsg=ERROR_MSG_TRANS_ID_NOT_FOUND,
|
||||||
info='DATAGRID_TRANSACTION_REQUIRED',
|
info='DATAGRID_TRANSACTION_REQUIRED',
|
||||||
status=404
|
status=404
|
||||||
)
|
)
|
||||||
|
@ -29,3 +29,14 @@ PGADMIN_NODE = 'pgadmin.node.%s'
|
|||||||
UNAUTH_REQ = "Unauthorized request."
|
UNAUTH_REQ = "Unauthorized request."
|
||||||
SERVER_CONNECTION_CLOSED = gettext(
|
SERVER_CONNECTION_CLOSED = gettext(
|
||||||
'Not connected to server or connection with the server has been closed.')
|
'Not connected to server or connection with the server has been closed.')
|
||||||
|
|
||||||
|
# Data Types
|
||||||
|
DATATYPE_TIME_WITH_TIMEZONE = 'time with time zone'
|
||||||
|
DATATYPE_TIME_WITHOUT_TIMEZONE = 'time without time zone'
|
||||||
|
|
||||||
|
DATATYPE_TIMESTAMP_WITH_TIMEZONE = 'timestamp with time zone'
|
||||||
|
DATATYPE_TIMESTAMP_WITHOUT_TIMEZONE = 'timestamp without time zone'
|
||||||
|
|
||||||
|
# Error Messages
|
||||||
|
ERROR_MSG_TRANS_ID_NOT_FOUND = gettext(
|
||||||
|
'Transaction ID not found in the session.')
|
||||||
|
Loading…
Reference in New Issue
Block a user