mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed code smell 'Define a constant instead of duplicating this literal' reported by SonarQube.
This commit is contained in:
@@ -15,6 +15,7 @@ from flask_babelex import Domain, gettext
|
||||
|
||||
from pgadmin.utils import PgAdminModule
|
||||
from pgadmin.utils.ajax import bad_request
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
|
||||
MODULE_NAME = 'tools'
|
||||
|
||||
@@ -73,5 +74,5 @@ def translations():
|
||||
return Response(
|
||||
response=template,
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
@@ -24,6 +24,7 @@ from pgadmin.utils.ajax import make_json_response, bad_request
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.model import Server
|
||||
from pgadmin.misc.bgprocess import escape_dquotes_process_arg
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
|
||||
# set template path for sql scripts
|
||||
MODULE_NAME = 'backup'
|
||||
@@ -230,7 +231,7 @@ def script():
|
||||
"backup/js/backup.js", _=_
|
||||
),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ from pgadmin.utils.preferences import Preferences
|
||||
from pgadmin.settings import get_setting
|
||||
from pgadmin.browser.utils import underscore_unescape
|
||||
from pgadmin.utils.exception import ObjectGone
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
|
||||
MODULE_NAME = 'datagrid'
|
||||
|
||||
@@ -453,7 +454,7 @@ def script():
|
||||
return Response(
|
||||
response=render_template("datagrid/js/datagrid.js", _=gettext),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ from pgadmin.tools.debugger.utils.debugger_instance import DebuggerInstance
|
||||
from pgadmin.browser.server_groups.servers.databases.extensions.utils \
|
||||
import get_extension_details
|
||||
from pgadmin.utils.constants import PREF_LABEL_DISPLAY, \
|
||||
PREF_LABEL_KEYBOARD_SHORTCUTS
|
||||
PREF_LABEL_KEYBOARD_SHORTCUTS, MIMETYPE_APP_JS
|
||||
|
||||
MODULE_NAME = 'debugger'
|
||||
|
||||
@@ -280,7 +280,7 @@ def script():
|
||||
return Response(
|
||||
response=render_template("debugger/js/debugger.js", _=gettext),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ def script_debugger_js():
|
||||
return Response(
|
||||
response=render_template("debugger/js/debugger_ui.js", _=gettext),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ def script_debugger_direct_js():
|
||||
return Response(
|
||||
response=render_template("debugger/js/direct.js", _=gettext),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.utils.ajax import precondition_required
|
||||
from functools import wraps
|
||||
from pgadmin.utils.preferences import Preferences
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
|
||||
# set template path for sql scripts
|
||||
MODULE_NAME = 'grant_wizard'
|
||||
@@ -156,7 +157,7 @@ def script():
|
||||
return Response(response=render_template(
|
||||
"grant_wizard/js/grant_wizard.js", _=gettext),
|
||||
status=200,
|
||||
mimetype="application/javascript")
|
||||
mimetype=MIMETYPE_APP_JS)
|
||||
|
||||
|
||||
@blueprint.route(
|
||||
|
||||
@@ -22,6 +22,7 @@ from pgadmin.utils.ajax import make_json_response, bad_request
|
||||
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.model import Server
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
|
||||
MODULE_NAME = 'import_export'
|
||||
|
||||
@@ -169,7 +170,7 @@ def script():
|
||||
return Response(
|
||||
response=render_template("import_export/js/import_export.js", _=_),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ from pgadmin.utils.driver import get_driver
|
||||
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.model import Server
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
|
||||
MODULE_NAME = 'maintenance'
|
||||
|
||||
@@ -164,7 +165,7 @@ def script():
|
||||
return Response(
|
||||
response=render_template("maintenance/js/maintenance.js", _=_),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from pgadmin.utils.ajax import make_json_response, bad_request
|
||||
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.model import Server
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
|
||||
# set template path for sql scripts
|
||||
MODULE_NAME = 'restore'
|
||||
@@ -151,7 +152,7 @@ def script():
|
||||
"restore/js/restore.js", _=_
|
||||
),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ from pgadmin.tools.schema_diff.model import SchemaDiffModel
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from pgadmin.utils.preferences import Preferences
|
||||
from pgadmin.utils.constants import PREF_LABEL_DISPLAY
|
||||
from pgadmin.utils.constants import PREF_LABEL_DISPLAY, MIMETYPE_APP_JS
|
||||
|
||||
MODULE_NAME = 'schema_diff'
|
||||
|
||||
@@ -140,7 +140,7 @@ def script():
|
||||
return Response(
|
||||
response=render_template("schema_diff/js/schema_diff.js", _=gettext),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ from pgadmin.tools.sqleditor.utils.query_tool_fs_utils import \
|
||||
read_file_generator
|
||||
from pgadmin.tools.sqleditor.utils.filter_dialog import FilterDialog
|
||||
from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
|
||||
MODULE_NAME = 'sqleditor'
|
||||
|
||||
@@ -1172,7 +1173,7 @@ def script():
|
||||
_=gettext
|
||||
),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ from pgadmin.utils import PgAdminModule
|
||||
from pgadmin.utils.ajax import make_response as ajax_response, \
|
||||
make_json_response, bad_request, internal_server_error
|
||||
from pgadmin.utils.csrf import pgCSRFProtect
|
||||
|
||||
from pgadmin.utils.constants import MIMETYPE_APP_JS
|
||||
from pgadmin.model import db, Role, User, UserPreference, Server, \
|
||||
ServerGroup, Process, Setting
|
||||
|
||||
@@ -150,7 +150,7 @@ def script():
|
||||
user_id=current_user.id
|
||||
),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ def current_user_info():
|
||||
auth_sources=config.AUTHENTICATION_SOURCES,
|
||||
),
|
||||
status=200,
|
||||
mimetype="application/javascript"
|
||||
mimetype=MIMETYPE_APP_JS
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user