Jelajahi Sumber

[config][cleanup] Fix bool to coerce_bool type conversion warning (#3860)

- These warnings pollute the initial logs generated after every Hue server restart
Harsh Gupta 1 tahun lalu
induk
melakukan
1df282a340

+ 1 - 1
apps/filebrowser/src/filebrowser/conf.py

@@ -73,7 +73,7 @@ SHOW_UPLOAD_BUTTON = Config(
 ENABLE_EXTRACT_UPLOADED_ARCHIVE = Config(
   key="enable_extract_uploaded_archive",
   help=_("Flag to enable the extraction of a uploaded archive in HDFS."),
-  type=bool,
+  type=coerce_bool,
   dynamic_default=is_oozie_enabled
 )
 

+ 8 - 12
apps/metastore/src/metastore/conf.py

@@ -15,33 +15,29 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import sys
-
-from desktop.lib.conf import Config
-
-if sys.version_info[0] > 2:
-  from django.utils.translation import gettext_lazy as _
-else:
-  from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
 
+from desktop.lib.conf import Config, coerce_bool
 
 ENABLE_NEW_CREATE_TABLE = Config(
   key="enable_new_create_table",
   help=_("Flag to turn on the new version of the create table wizard."),
-  type=bool,
+  type=coerce_bool,
   default=True
 )
 
 FORCE_HS2_METADATA = Config(
   key="force_hs2_metadata",
-  help=_("Flag to force all metadata calls (e.g. list tables, table or column details...) to happen via HiveServer2 if available instead of Impala."),
-  type=bool,
+  help=_(
+    "Flag to force all metadata calls (e.g. list tables, table or column details...) to happen via HS2 if available instead of Impala."
+  ),
+  type=coerce_bool,
   default=False
 )
 
 SHOW_TABLE_ERD = Config(
   key="show_table_erd",
   default=False,
-  type=bool,
+  type=coerce_bool,
   help=_('Choose whether to show the table ERD component.')
 )