public inbox for [email protected]
help / color / mirror / Atom feedFrom: Pradip Parkale <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][SonarQube] : Remove duplicates string literals.
Date: Thu, 3 Sep 2020 16:29:44 +0530
Message-ID: <CAJ9T6SvWCLEOctFXnynEefeo-df40RoE-m6JjCqjvOPXzJ01fg@mail.gmail.com> (raw)
Hi Hackers,
Attached is a patch for removing duplicates string literals.
/server_groups/servers/roles/__init__.py - 8 places
--
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
Attachments:
[application/octet-stream] sonar_Qube_v1.patch (5.1K, 3-sonar_Qube_v1.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/roles/__init__.py b/web/pgadmin/browser/server_groups/servers/roles/__init__.py
index 5c78c09ee..927101b81 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/roles/__init__.py
@@ -20,6 +20,8 @@ from pgadmin.utils.ajax import make_json_response, \
make_response as ajax_response, precondition_required, \
internal_server_error, forbidden, success_return, gone
from pgadmin.utils.driver import get_driver
+from pgadmin.utils.constants import ROLE_NOT_FOUND, \
+ ERROR_FETCHING_ROLE_INFORMATION
from config import PG_DEFAULT_DRIVER
@@ -641,10 +643,7 @@ rolmembership:{
if not status:
return internal_server_error(
_(
- "Error fetching role information from the database "
- "server.\n{0}"
- ).format(rset)
- )
+ ERROR_FETCHING_ROLE_INFORMATION + "\n{0}").format(rset))
res = []
for row in rset['rows']:
@@ -676,10 +675,7 @@ rolmembership:{
if not status:
return internal_server_error(
_(
- "Error fetching role information from the database "
- "server.\n{0}"
- ).format(rset)
- )
+ ERROR_FETCHING_ROLE_INFORMATION + "\n{0}").format(rset))
for row in rset['rows']:
return make_json_response(
@@ -693,7 +689,7 @@ rolmembership:{
status=200
)
- return gone(_("Could not find the role information."))
+ return gone(_(ROLE_NOT_FOUND))
def transform(self, rset):
for row in rset['rows']:
@@ -736,7 +732,7 @@ rolmembership:{
self.transform(res)
if len(res['rows']) == 0:
- return gone(_("Could not find the role information."))
+ return gone(_(ROLE_NOT_FOUND))
res['rows'][0]['is_sys_obj'] = (
res['rows'][0]['oid'] <= self.datlastsysoid)
@@ -853,10 +849,7 @@ rolmembership:{
if not status:
return internal_server_error(
_(
- "Error fetching role information from the database "
- "server.\n{0}"
- ).format(rset)
- )
+ ERROR_FETCHING_ROLE_INFORMATION + "\n{0}").format(rset))
for row in rset['rows']:
return jsonify(
node=self.blueprint.generate_browser_node(
@@ -867,7 +860,7 @@ rolmembership:{
)
)
- return gone(_("Could not find the role information."))
+ return gone(_(ROLE_NOT_FOUND))
@check_precondition(action='update')
@validate_request
@@ -901,10 +894,7 @@ rolmembership:{
if not status:
return internal_server_error(
_(
- "Error fetching role information from the database "
- "server.\n{0}"
- ).format(rset)
- )
+ ERROR_FETCHING_ROLE_INFORMATION + "\n{0}").format(rset))
for row in rset['rows']:
return jsonify(
@@ -917,7 +907,7 @@ rolmembership:{
)
)
- return gone(_("Could not find the role information."))
+ return gone(_(ROLE_NOT_FOUND))
@check_precondition(action='msql')
@validate_request
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js
index 9170e0d44..e48524924 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/server.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js
@@ -744,7 +744,6 @@ define('pgadmin.node.server', [
// Default values!
initialize: function(attrs, args) {
var isNew = (_.size(attrs) === 0);
- console.warn('warn');
if (isNew) {
this.set({'gid': args.node_info['server_group']._id});
diff --git a/web/pgadmin/utils/constants.py b/web/pgadmin/utils/constants.py
index 88ae50de2..76a392789 100644
--- a/web/pgadmin/utils/constants.py
+++ b/web/pgadmin/utils/constants.py
@@ -29,3 +29,8 @@ PGADMIN_NODE = 'pgadmin.node.%s'
UNAUTH_REQ = "Unauthorized request."
SERVER_CONNECTION_CLOSED = gettext(
'Not connected to server or connection with the server has been closed.')
+
+# Role module constant
+ROLE_NOT_FOUND = gettext("Could not find the role information.")
+ERROR_FETCHING_ROLE_INFORMATION = gettext(
+ "Error fetching role information from the database server.")
diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py
index 022856c0c..43be73820 100644
--- a/web/regression/python_test_utils/test_utils.py
+++ b/web/regression/python_test_utils/test_utils.py
@@ -1681,8 +1681,7 @@ def get_test_user(self, user_details,
def create_user_wise_test_client(user):
"""
- This function creates new test client and pem database connection as per
- provided user and execute the test cases.
+ This function creates new test client and execute the test cases.
:return: None
"""
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin][SonarQube] : Remove duplicates string literals.
In-Reply-To: <CAJ9T6SvWCLEOctFXnynEefeo-df40RoE-m6JjCqjvOPXzJ01fg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox