Fixed code smells 'Define a constant instead of duplicating this literal' reported by SonarQube.

This commit is contained in:
Akshay Joshi
2020-09-29 15:08:14 +05:30
parent c7c199210d
commit 1c70a43b91
22 changed files with 167 additions and 176 deletions

View File

@@ -98,6 +98,7 @@ class BackupMessage(IProcessDesc):
self.bfile = _bfile
self.database = _kwargs['database'] if 'database' in _kwargs else None
self.cmd = ''
self.args_str = "{0} ({1}:{2})"
def cmd_arg(x):
if x:
@@ -151,22 +152,19 @@ class BackupMessage(IProcessDesc):
return _(
"Backing up an object on the server '{0}' "
"from database '{1}'"
).format(
"{0} ({1}:{2})".format(
name, host, port
),
html.safe_str(self.database)
)
).format(self.args_str.format(name, host, port),
html.safe_str(self.database)
)
if self.backup_type == BACKUP.GLOBALS:
return _("Backing up the global objects on "
"the server '{0}'").format(
"{0} ({1}:{2})".format(
self.args_str.format(
name, host, port
)
)
elif self.backup_type == BACKUP.SERVER:
return _("Backing up the server '{0}'").format(
"{0} ({1}:{2})".format(
self.args_str.format(
name, host, port
)
)
@@ -184,7 +182,7 @@ class BackupMessage(IProcessDesc):
"Backing up an object on the server '{0}' "
"from database '{1}'..."
).format(
"{0} ({1}:{2})".format(
self.args_str.format(
name, host, port
),
self.database
@@ -193,14 +191,14 @@ class BackupMessage(IProcessDesc):
elif self.backup_type == BACKUP.GLOBALS:
msg = _("Backing up the global objects on "
"the server '{0}'...").format(
"{0} ({1}:{2})".format(
self.args_str.format(
name, host, port
)
)
res += html.safe_str(msg)
elif self.backup_type == BACKUP.SERVER:
msg = _("Backing up the server '{0}'...").format(
"{0} ({1}:{2})".format(
self.args_str.format(
name, host, port
)
)