public inbox for [email protected]  
help / color / mirror / Atom feed
From: Aditya Toshniwal <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: Libor M. <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: pgAdmin 4 - next gettext usage fixes
Date: Wed, 15 Apr 2020 11:38:11 +0530
Message-ID: <CAM9w-_kyiCB-FFtkXpvUNYKsz2iauZcm-vDs30dgW7rXDdDD-A@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDcg=Jpkj5+16KNgAG171mz1bSF-+oFLRb_B4KAEO8Lb4w@mail.gmail.com>
References: <CAMavuw0OE=bo6a3Pf+cXUTa0UDrFSyQxsffUrf5uXcvLnTSajg@mail.gmail.com>
	<CANxoLDcg=Jpkj5+16KNgAG171mz1bSF-+oFLRb_B4KAEO8Lb4w@mail.gmail.com>

Hi Hackers/Libor,

The changes like below are incorrect. Try "Count rows" from a table's
context menu.

-            info=gettext("Table rows counted: %s" % count),

+            info=gettext("Table rows counted: %s") % count,

Attached is the patch to fix all such changes in pgAdmin, to use format()
instead.
Please review.

On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <[email protected]>
wrote:

> Hi Libor
>
> Thanks, patch applied. Please make sure to run the PEP8 checks before
> sending the patch.
> I have fixed and committed the code.
>
> On Wed, Apr 8, 2020 at 9:30 PM Libor M. <[email protected]> wrote:
>
>> Hello,
>> I fixed next gettext usage:
>>
>> - fixed gettext usage with .format() only for original text with %s
>> - fixed typos
>> - fixed translation yes/no buttons in dialog
>> - improved translating sentences without "connecting" words (eg. see
>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to
>> be translated in Czech language as 'zrušit' but in another sentence as
>> 'zrušení')
>> - added gettext for text translations
>>
>> Diff file is attached.
>>
>> Best regards,
>>
>> Libor M.
>>
>> E-mail: [email protected]
>> GitHub: https://github.com/liborm85
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
>
> *Sr. Software Architect*
> *EnterpriseDB Software India Private Limited*
> *Mobile: +91 976-788-8246*
>


-- 
Thanks and Regards,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


Attachments:

  [application/octet-stream] gettext_format_fixes.patch (28.3K, 3-gettext_format_fixes.patch)
  download | inline diff:
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index ef6461ee4..dd5fc0535 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -503,13 +503,13 @@ def create_app(app_name=None):
                             svr_discovery_id = inst_id
                             svr_comment = gettext(
                                 "Auto-detected %s installation with the data "
-                                "directory at %s") % (
+                                "directory at {}".format(
                                     winreg.QueryValueEx(
                                         inst_key, 'Display Name'
                                     )[0],
                                     winreg.QueryValueEx(
                                         inst_key, 'Data Directory'
-                                    )[0])
+                                    )[0]))
 
                             add_server(
                                 user_id, servergroup_id, svr_name,
@@ -557,11 +557,12 @@ def create_app(app_name=None):
                     if hasattr(str, 'decode'):
                         description = description.decode('utf-8')
                         data_directory = data_directory.decode('utf-8')
-                    svr_comment = gettext(u"Auto-detected %s installation "
-                                          u"with the data directory at %s") % (
+                    svr_comment = gettext(u"Auto-detected {0} installation "
+                                          u"with the data directory at {1}".
+                                          format(
                                               description,
                                               data_directory
-                    )
+                                          ))
                     add_server(user_id, servergroup_id, svr_name,
                                svr_superuser, svr_port, svr_discovery_id,
                                svr_comment)
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index d62d69138..59efae8b1 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -737,7 +737,8 @@ class ServerNode(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         if 'hostaddr' in data and data['hostaddr'] and data['hostaddr'] != '':
@@ -835,7 +836,8 @@ class ServerNode(PGChildNodeView):
                         status=401,
                         success=0,
                         errormsg=gettext(
-                            u"Unable to connect to server:\n\n%s") % errmsg
+                            u"Unable to connect to server:\n\n{}".
+                            format(errmsg))
                     )
                 else:
                     if 'save_password' in data and data['save_password'] and \
@@ -1027,7 +1029,7 @@ class ServerNode(PGChildNodeView):
                     tunnel_password = server.tunnel_password
             else:
                 tunnel_password = data['tunnel_password'] \
-                    if 'tunnel_password'in data else ''
+                    if 'tunnel_password' in data else ''
                 save_tunnel_password = data['save_tunnel_password'] \
                     if tunnel_password and 'save_tunnel_password' in data \
                     else False
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 085ee35b6..db6e1273a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -567,7 +567,8 @@ class DatabaseView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         # The below SQL will execute CREATE DDL only
         SQL = render_template(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
index 503192cb2..5558d97f8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/casts/__init__.py
@@ -368,7 +368,8 @@ class CastView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         try:
             sql = render_template("/".join([self.template_path, 'create.sql']),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
index 42da4cfc4..45f11e655 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
@@ -378,7 +378,7 @@ class EventTriggerView(PGChildNodeView):
                 status=400,
                 success=0,
                 errormsg=gettext(
-                    "Could not find the required parameter %s.") % err
+                    "Could not find the required parameter {}.".format(err))
             )
         try:
             sql = render_template(
@@ -636,7 +636,8 @@ class EventTriggerView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter %s.") % err
+                        "Could not find the required parameter {}.".
+                        format(err))
                 )
             sql = render_template(
                 "/".join([self.template_path, 'create.sql']),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index 9605b9b4a..f19b3452e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -262,7 +262,8 @@ class ExtensionView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         status, res = self.conn.execute_dict(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
index e5bf06357..bb8d5482f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/__init__.py
@@ -393,7 +393,8 @@ class ForeignDataWrapperView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
index 66fcf424b..acf07617a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py
@@ -388,7 +388,8 @@ class ForeignServerView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         try:
             if 'fsrvacl' in data:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
index 47e55570a..1ee66eade 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mappings/__init__.py
@@ -396,7 +396,8 @@ class UserMappingView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index 77f22e6fa..d5ed9e297 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -453,7 +453,8 @@ class LanguageView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
index 38cdec02c..67835b431 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
@@ -570,8 +570,8 @@ It may have been removed by another user.
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") %
-                    required_args[arg]
+                        "Could not find the required parameter ({}).".
+                        format(required_args[arg]))
                 )
         try:
             self.format_request_acls(data)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
index 8cf703987..89f7ae547 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
@@ -458,7 +458,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         if self._check_definition(data):
             return make_json_response(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
index 362f7c6ce..169d8da3f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py
@@ -422,7 +422,8 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         # Either copy config or parser must be present in data
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
index b79b6ef5b..0f0b1f6bb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parsers/__init__.py
@@ -379,7 +379,8 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         # Fetch schema name from schema oid
         sql = render_template(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
index 4d61e8dcb..18bf3b8d2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py
@@ -354,7 +354,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         # Fetch schema name from schema oid
         sql = render_template("/".join([self.template_path, 'schema.sql']),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py
index 519e30e97..b2a85090f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py
@@ -379,7 +379,8 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         data['schema'] = self.schema
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
index 13623b737..ca9e46e8a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
@@ -450,7 +450,8 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         try:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index bea7b33f4..2c7ea56e5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -908,7 +908,8 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         # Parse privilege data coming from client according to database format
@@ -1577,7 +1578,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
 
         return make_json_response(
             status=200,
-            info=gettext("Table rows counted: %s") % count,
+            info=gettext("Table rows counted: {}".format(count)),
             data={'total_rows': count}
         )
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
index 280958a98..c443749cc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/__init__.py
@@ -392,8 +392,8 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") %
-                    required_args[arg]
+                        "Could not find the required parameter ({}).".
+                        format(required_args[arg]))
                 )
 
         # Parse privilege data coming from client according to database format
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
index 553d06c31..4b56d0b8c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/__init__.py
@@ -511,8 +511,8 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") %
-                    required_args[arg]
+                        "Could not find the required parameter ({})."
+                        .format(required_args[arg]))
                 )
 
         # Adding parent into data dict, will be using it while creating sql
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
index 2f1ba57bb..d65d3cc33 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py
@@ -476,7 +476,8 @@ class CheckConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
index ab3ee6ab5..b2a5bbbe5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py
@@ -496,14 +496,16 @@ class ExclusionConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({}).".
+                        format(str(arg)))
                 )
             elif isinstance(data[arg], list) and len(data[arg]) < 1:
                 return make_json_response(
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({}).".
+                        format(str(arg)))
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
index d057a3f2f..1abbc45b3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py
@@ -514,14 +514,16 @@ class ForeignKeyConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({}).".
+                        format(str(arg)))
                 )
             elif isinstance(data[arg], list) and len(data[arg]) < 1:
                 return make_json_response(
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find required parameter (%s).") % str(arg)
+                        "Could not find required parameter ({}).".
+                        format(str(arg)))
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
index 05c5f84d1..bd2974c3d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py
@@ -535,7 +535,7 @@ class IndexConstraintView(PGChildNodeView):
                         success=0,
                         errormsg=_(
                             "Could not find at least one required "
-                            "parameter (%s).") % str(param)
+                            "parameter ({}).".format(str(param)))
                     )
 
             elif arg not in data:
@@ -543,7 +543,8 @@ class IndexConstraintView(PGChildNodeView):
                     status=400,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         data['schema'] = self.schema
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
index 02eb23b02..970933479 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
@@ -946,8 +946,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") %
-                    required_args[arg]
+                        "Could not find the required parameter ({}).".
+                        format(required_args[arg]))
                 )
             # Additional checks goes here
             # If type is range then check if subtype is defined or not
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index 955af8bc1..5d8d16249 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -493,7 +493,8 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         try:
             SQL, nameOrError = self.getSQL(gid, sid, did, data)
@@ -743,7 +744,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
                                  ).split('FROM')
                 if 'definition' in data and (
                         len(old_def) > 1 or len(new_def) > 1
-                ) and(
+                ) and (
                         old_def[0] != new_def[0] and
                         old_def[0] not in new_def[0]
                 ):
diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
index 28a8e5901..cb852f84c 100644
--- a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
@@ -284,7 +284,8 @@ SELECT EXISTS(
                     status=410,
                     success=0,
                     errormsg=_(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
 
         status, res = self.conn.execute_void('BEGIN')
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
index 24d3206ad..c68a09b9a 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py
@@ -363,7 +363,8 @@ class ResourceGroupView(NodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") % arg
+                        "Could not find the required parameter ({}).".
+                        format(arg))
                 )
         try:
             # Below logic will create new resource group
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
index 73e81e1b1..04954b80b 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
@@ -295,8 +295,8 @@ class TablespaceView(PGChildNodeView):
                     status=410,
                     success=0,
                     errormsg=gettext(
-                        "Could not find the required parameter (%s).") %
-                    required_args[arg]
+                        "Could not find the required parameter ({}).".
+                        format(required_args[arg]))
                 )
 
         # To format privileges coming from client


view thread (11+ 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], [email protected], [email protected]
  Subject: Re: pgAdmin 4 - next gettext usage fixes
  In-Reply-To: <CAM9w-_kyiCB-FFtkXpvUNYKsz2iauZcm-vDs30dgW7rXDdDD-A@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