Various misc fixes:

- Using the 'gettext' as oppose to '_', which is not defined
- Define missing variables
- Fixed escape character in string with double quote
- Removed some dead code in a test case
- Removed unnecessary self assignment

Includes some fixes for Accessibility improvements
- Use semantic markup to mark emphasized or special text
- Added hidden legend in <fieldset> for better screen reader support
This commit is contained in:
Ashesh Vashi
2020-04-08 14:14:25 +05:30
parent 8fe687eb55
commit d9f6baac72
15 changed files with 28 additions and 59 deletions

View File

@@ -1506,7 +1506,7 @@ class ServerNode(PGChildNodeView):
conn = manager.connection()
if not conn.connected():
return gone(
errormsg=_('Please connect the server.')
errormsg=gettext('Please connect the server.')
)
if not server.password or not manager.password:

View File

@@ -259,6 +259,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
Returns:
"""
res = []
SQL = render_template(
"/".join([self.template_path, 'properties.sql']),
scid=scid, pkgid=pkgid
@@ -778,7 +779,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
if sql is None:
return None
start = 0
start_position = re.search("\s+[is|as]+\s+", sql, flags=re.I)
start_position = re.search("\\s+[is|as]+\\s+", sql, flags=re.I)
if start_position:
start = start_position.start() + 4

View File

@@ -588,7 +588,7 @@ class ResourceGroupView(NodeView):
if len(res['rows']) == 0:
return gone(
_("The specified resource group could not be found.")
gettext("The specified resource group could not be found.")
)
old_data = res['rows'][0]
for arg in required_args:
@@ -655,7 +655,7 @@ class ResourceGroupView(NodeView):
return internal_server_error(errormsg=res)
if len(res['rows']) == 0:
return gone(
_("The specified resource group could not be found.")
gettext("The specified resource group could not be found.")
)
# Making copy of output for future use

View File

@@ -60,13 +60,12 @@ def test_getrole(tester):
server_ids = all_id["sid"]
role_ids_dict = all_id["lrid"][0]
server_group = config_data['server_group']
role_response_data = []
for server_id in server_ids:
role_id = role_ids_dict[int(server_id)]
role_response_data.append(
verify_role(tester, server_group, server_id, role_id))
verify_role(server_id, role_id))
return role_response_data
@@ -122,34 +121,6 @@ def create_role(server, role_name):
print(exception, file=sys.stderr)
def write_role_id(response_data):
"""
:param response_data:
:return:
"""
lr_id = response_data['node']['_id']
server_id = response_data['node']['_pid']
pickle_id_dict = utils.get_pickle_id_dict()
# TODO: modify logic to write in file / file exists or create new check
# old file
if os.path.isfile(pickle_path):
existing_server_id = open(pickle_path, 'rb')
tol_server_id = pickle.load(existing_server_id)
pickle_id_dict = tol_server_id
if 'lrid' in pickle_id_dict:
if pickle_id_dict['lrid']:
# Add the db_id as value in dict
pickle_id_dict["lrid"][0].update({server_id: lr_id})
else:
# Create new dict with server_id and db_id
pickle_id_dict["lrid"].append({server_id: lr_id})
db_output = open(pickle_path, 'wb')
pickle.dump(pickle_id_dict, db_output)
db_output.close()
def delete_role(connection, role_names):
"""
This function use to delete the existing roles in the servers

View File

@@ -485,7 +485,7 @@ class TablespaceView(PGChildNodeView):
if len(res['rows']) == 0:
return gone(
_("Could not find the tablespace on the server.")
gettext("Could not find the tablespace on the server.")
)
# Making copy of output for further processing
@@ -550,7 +550,7 @@ class TablespaceView(PGChildNodeView):
if len(res['rows']) == 0:
return gone(
_("Could not find the tablespace on the server.")
gettext("Could not find the tablespace on the server.")
)
# Making copy of output for future use
old_data = dict(res['rows'][0])