Browse Source

[Dajngo 4.0 Warning] RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy()

ayush.goyal 5 years ago
parent
commit
1b4f8b4856
100 changed files with 538 additions and 130 deletions
  1. 7 1
      apps/about/src/about/templates/admin_wizard.mako
  2. 6 2
      apps/about/src/about/views.py
  3. 6 1
      apps/beeswax/src/beeswax/api.py
  4. 6 2
      apps/beeswax/src/beeswax/conf.py
  5. 6 1
      apps/beeswax/src/beeswax/create_table.py
  6. 6 2
      apps/beeswax/src/beeswax/data_export.py
  7. 6 1
      apps/beeswax/src/beeswax/design.py
  8. 7 1
      apps/beeswax/src/beeswax/forms.py
  9. 5 1
      apps/beeswax/src/beeswax/management/commands/beeswax_install_examples.py
  10. 6 2
      apps/beeswax/src/beeswax/management/commands/create_table_query_data.py
  11. 5 1
      apps/beeswax/src/beeswax/models.py
  12. 6 2
      apps/beeswax/src/beeswax/query_history.py
  13. 4 1
      apps/beeswax/src/beeswax/server/dbms.py
  14. 6 1
      apps/beeswax/src/beeswax/server/hive_metastore_server.py
  15. 5 1
      apps/beeswax/src/beeswax/server/hive_server2_lib.py
  16. 6 1
      apps/beeswax/src/beeswax/templates/beeswax_components.mako
  17. 7 1
      apps/beeswax/src/beeswax/templates/configuration.mako
  18. 6 1
      apps/beeswax/src/beeswax/templates/confirm.mako
  19. 7 1
      apps/beeswax/src/beeswax/templates/create_database.mako
  20. 7 1
      apps/beeswax/src/beeswax/templates/create_table_manually.mako
  21. 7 1
      apps/beeswax/src/beeswax/templates/execute.mako
  22. 7 1
      apps/beeswax/src/beeswax/templates/import_wizard_choose_delimiter.mako
  23. 7 1
      apps/beeswax/src/beeswax/templates/import_wizard_choose_file.mako
  24. 7 1
      apps/beeswax/src/beeswax/templates/import_wizard_define_columns.mako
  25. 6 1
      apps/beeswax/src/beeswax/templates/layout.mako
  26. 2 1
      apps/beeswax/src/beeswax/templates/list_designs.mako
  27. 6 1
      apps/beeswax/src/beeswax/templates/list_history.mako
  28. 6 1
      apps/beeswax/src/beeswax/templates/list_trashed_designs.mako
  29. 5 1
      apps/beeswax/src/beeswax/templates/my_queries.mako
  30. 5 1
      apps/beeswax/src/beeswax/templates/save_results.mako
  31. 5 1
      apps/beeswax/src/beeswax/templates/util.mako
  32. 5 1
      apps/beeswax/src/beeswax/templates/watch_results.mako
  33. 5 1
      apps/beeswax/src/beeswax/views.py
  34. 6 1
      apps/filebrowser/src/filebrowser/conf.py
  35. 2 1
      apps/filebrowser/src/filebrowser/forms.py
  36. 5 1
      apps/filebrowser/src/filebrowser/lib/archives.py
  37. 2 1
      apps/filebrowser/src/filebrowser/templates/display.mako
  38. 7 1
      apps/filebrowser/src/filebrowser/templates/edit.mako
  39. 2 1
      apps/filebrowser/src/filebrowser/templates/fb_components.mako
  40. 7 1
      apps/filebrowser/src/filebrowser/templates/fileop.mako
  41. 6 1
      apps/filebrowser/src/filebrowser/templates/listdir.mako
  42. 7 1
      apps/filebrowser/src/filebrowser/templates/listdir_components.mako
  43. 2 1
      apps/filebrowser/src/filebrowser/views.py
  44. 3 5
      apps/filebrowser/src/filebrowser/views_test.py
  45. 5 1
      apps/hbase/src/hbase/api.py
  46. 4 2
      apps/hbase/src/hbase/conf.py
  47. 5 1
      apps/hbase/src/hbase/management/commands/hbase_setup.py
  48. 6 1
      apps/hbase/src/hbase/templates/app.mako
  49. 2 2
      apps/hbase/src/hbase/views.py
  50. 4 2
      apps/hive/src/hive/conf.py
  51. 6 1
      apps/impala/src/impala/api.py
  52. 4 2
      apps/impala/src/impala/conf.py
  53. 6 2
      apps/impala/src/impala/dbms.py
  54. 5 2
      apps/impala/src/impala/server.py
  55. 5 1
      apps/jobbrowser/src/jobbrowser/api.py
  56. 6 1
      apps/jobbrowser/src/jobbrowser/api2.py
  57. 5 2
      apps/jobbrowser/src/jobbrowser/apis/base_api.py
  58. 5 2
      apps/jobbrowser/src/jobbrowser/apis/beat_api.py
  59. 6 2
      apps/jobbrowser/src/jobbrowser/apis/beeswax_query_api.py
  60. 5 2
      apps/jobbrowser/src/jobbrowser/apis/bundle_api.py
  61. 5 1
      apps/jobbrowser/src/jobbrowser/apis/clusters.py
  62. 5 2
      apps/jobbrowser/src/jobbrowser/apis/data_eng_api.py
  63. 5 1
      apps/jobbrowser/src/jobbrowser/apis/data_warehouse.py
  64. 6 2
      apps/jobbrowser/src/jobbrowser/apis/history.py
  65. 6 1
      apps/jobbrowser/src/jobbrowser/apis/hive_query_api.py
  66. 6 1
      apps/jobbrowser/src/jobbrowser/apis/job_api.py
  67. 5 2
      apps/jobbrowser/src/jobbrowser/apis/livy_api.py
  68. 6 2
      apps/jobbrowser/src/jobbrowser/apis/query_api.py
  69. 6 2
      apps/jobbrowser/src/jobbrowser/apis/schedule_api.py
  70. 5 2
      apps/jobbrowser/src/jobbrowser/apis/schedule_hive.py
  71. 5 2
      apps/jobbrowser/src/jobbrowser/apis/workflow_api.py
  72. 6 1
      apps/jobbrowser/src/jobbrowser/conf.py
  73. 6 1
      apps/jobbrowser/src/jobbrowser/models.py
  74. 5 1
      apps/jobbrowser/src/jobbrowser/templates/attempt.mako
  75. 5 1
      apps/jobbrowser/src/jobbrowser/templates/attempt_logs.mako
  76. 5 1
      apps/jobbrowser/src/jobbrowser/templates/container.mako
  77. 6 1
      apps/jobbrowser/src/jobbrowser/templates/job.mako
  78. 5 1
      apps/jobbrowser/src/jobbrowser/templates/job_attempt_logs.mako
  79. 6 1
      apps/jobbrowser/src/jobbrowser/templates/job_browser.mako
  80. 5 1
      apps/jobbrowser/src/jobbrowser/templates/job_not_assigned.mako
  81. 5 1
      apps/jobbrowser/src/jobbrowser/templates/jobbrowser_components.mako
  82. 5 1
      apps/jobbrowser/src/jobbrowser/templates/jobs.mako
  83. 5 1
      apps/jobbrowser/src/jobbrowser/templates/task.mako
  84. 5 1
      apps/jobbrowser/src/jobbrowser/templates/tasks.mako
  85. 5 1
      apps/jobbrowser/src/jobbrowser/templates/tasktracker.mako
  86. 5 1
      apps/jobbrowser/src/jobbrowser/templates/tasktrackers.mako
  87. 5 1
      apps/jobbrowser/src/jobbrowser/templatetags/unix_ms_to_datetime.py
  88. 4 1
      apps/jobbrowser/src/jobbrowser/views.py
  89. 5 4
      apps/jobbrowser/src/jobbrowser/yarn_models.py
  90. 6 1
      apps/jobsub/src/jobsub/conf.py
  91. 5 1
      apps/jobsub/src/jobsub/forms.py
  92. 5 1
      apps/jobsub/src/jobsub/models.py
  93. 7 1
      apps/jobsub/src/jobsub/old_migrations/0005_unify_with_oozie.py
  94. 7 1
      apps/jobsub/src/jobsub/old_migrations/0006_chg_varchars_to_textfields.py
  95. 5 1
      apps/jobsub/src/jobsub/templates/designs.mako
  96. 5 1
      apps/jobsub/src/jobsub/templates/not_available.mako
  97. 6 2
      apps/jobsub/src/jobsub/views.py
  98. 6 1
      apps/metastore/src/metastore/conf.py
  99. 7 1
      apps/metastore/src/metastore/forms.py
  100. 5 1
      apps/metastore/src/metastore/templates/components.mako

+ 7 - 1
apps/about/src/about/templates/admin_wizard.mako

@@ -15,8 +15,9 @@
 ## limitations under the License.
 ## limitations under the License.
 
 
 <%!
 <%!
+import sys
+
 from django.urls import reverse
 from django.urls import reverse
-from django.utils.translation import ugettext as _
 
 
 from metadata.conf import OPTIMIZER, has_optimizer
 from metadata.conf import OPTIMIZER, has_optimizer
 
 
@@ -24,6 +25,11 @@ from desktop.auth.backend import is_admin
 from desktop.conf import has_connectors
 from desktop.conf import has_connectors
 from desktop.lib.i18n import smart_unicode
 from desktop.lib.i18n import smart_unicode
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="layout" file="/about_layout.mako" />
 <%namespace name="layout" file="/about_layout.mako" />

+ 6 - 2
apps/about/src/about/views.py

@@ -17,8 +17,7 @@
 
 
 from builtins import str
 from builtins import str
 import logging
 import logging
-
-from django.utils.translation import ugettext as _
+import sys
 
 
 from desktop import appmanager
 from desktop import appmanager
 from desktop.auth.backend import is_hue_admin
 from desktop.auth.backend import is_hue_admin
@@ -27,6 +26,11 @@ from desktop.lib.django_util import JsonResponse, render
 from desktop.models import Settings, hue_version
 from desktop.models import Settings, hue_version
 from desktop.views import collect_usage
 from desktop.views import collect_usage
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 def admin_wizard(request):
 def admin_wizard(request):
   if is_hue_admin(request.user):
   if is_hue_admin(request.user):

+ 6 - 1
apps/beeswax/src/beeswax/api.py

@@ -19,10 +19,10 @@ from builtins import zip
 import logging
 import logging
 import json
 import json
 import re
 import re
+import sys
 
 
 from django.urls import reverse
 from django.urls import reverse
 from django.http import Http404
 from django.http import Http404
-from django.utils.translation import ugettext as _
 from django.views.decorators.http import require_POST
 from django.views.decorators.http import require_POST
 
 
 from thrift.transport.TTransport import TTransportException
 from thrift.transport.TTransport import TTransportException
@@ -51,6 +51,11 @@ from beeswax.server.dbms import expand_exception, get_query_server_config, Query
 from beeswax.views import authorized_get_design, authorized_get_query_history, make_parameterization_form, \
 from beeswax.views import authorized_get_design, authorized_get_query_history, make_parameterization_form, \
     safe_get_design, save_design, massage_columns_for_json, _get_query_handle_and_state, parse_out_jobs
     safe_get_design, save_design, massage_columns_for_json, _get_query_handle_and_state, parse_out_jobs
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 2
apps/beeswax/src/beeswax/conf.py

@@ -20,13 +20,17 @@ from builtins import str
 import logging
 import logging
 import math
 import math
 import os.path
 import os.path
-
-from django.utils.translation import ugettext_lazy as _t, ugettext as _
+import sys
 
 
 from desktop.conf import default_ssl_cacerts, default_ssl_validate, AUTH_PASSWORD as DEFAULT_AUTH_PASSWORD,\
 from desktop.conf import default_ssl_cacerts, default_ssl_validate, AUTH_PASSWORD as DEFAULT_AUTH_PASSWORD,\
   AUTH_USERNAME as DEFAULT_AUTH_USERNAME
   AUTH_USERNAME as DEFAULT_AUTH_USERNAME
 from desktop.lib.conf import ConfigSection, Config, coerce_bool, coerce_csv, coerce_password_from_script
 from desktop.lib.conf import ConfigSection, Config, coerce_bool, coerce_csv, coerce_password_from_script
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext_lazy as _t, gettext as _
+else:
+  from django.utils.translation import ugettext_lazy as _t, ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/beeswax/src/beeswax/create_table.py

@@ -26,10 +26,10 @@ import json
 import logging
 import logging
 import math
 import math
 import re
 import re
+import sys
 
 
 from django.urls import reverse
 from django.urls import reverse
 from django.http import QueryDict
 from django.http import QueryDict
-from django.utils.translation import ugettext as _
 
 
 from aws.s3.s3fs import S3FileSystemException
 from aws.s3.s3fs import S3FileSystemException
 from desktop.context_processors import get_app_name
 from desktop.context_processors import get_app_name
@@ -49,6 +49,11 @@ from beeswax.server import dbms
 from beeswax.server.dbms import QueryServerException
 from beeswax.server.dbms import QueryServerException
 from beeswax.views import execute_directly
 from beeswax.views import execute_directly
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 2
apps/beeswax/src/beeswax/data_export.py

@@ -20,13 +20,17 @@ from builtins import object
 import json
 import json
 import logging
 import logging
 import math
 import math
+import sys
 import types
 import types
 
 
-from django.utils.translation import ugettext as _
-
 from desktop.lib import export_csvxls
 from desktop.lib import export_csvxls
 from beeswax import common, conf
 from beeswax import common, conf
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/beeswax/src/beeswax/design.py

@@ -26,17 +26,22 @@ import json
 import logging
 import logging
 import os
 import os
 import re
 import re
+import sys
 import urllib.parse
 import urllib.parse
 
 
 import django.http
 import django.http
 from django import forms
 from django import forms
 from django.forms import ValidationError
 from django.forms import ValidationError
-from django.utils.translation import ugettext as _
 
 
 from notebook.sql_utils import split_statements, strip_trailing_semicolon
 from notebook.sql_utils import split_statements, strip_trailing_semicolon
 from desktop.lib.django_forms import BaseSimpleFormSet, MultiForm
 from desktop.lib.django_forms import BaseSimpleFormSet, MultiForm
 from hadoop.cluster import get_hdfs
 from hadoop.cluster import get_hdfs
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 7 - 1
apps/beeswax/src/beeswax/forms.py

@@ -15,9 +15,10 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
+import sys
+
 from builtins import chr
 from builtins import chr
 from django import forms
 from django import forms
-from django.utils.translation import ugettext as _, ugettext_lazy as _t
 from django.core.validators import MinValueValidator, MaxValueValidator
 from django.core.validators import MinValueValidator, MaxValueValidator
 from django.forms import NumberInput
 from django.forms import NumberInput
 
 
@@ -28,6 +29,11 @@ from filebrowser.forms import PathField
 from beeswax import common
 from beeswax import common
 from beeswax.models import SavedQuery
 from beeswax.models import SavedQuery
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _, gettext_lazy as _t
+else:
+  from django.utils.translation import ugettext as _, ugettext_lazy as _t
+
 
 
 class QueryForm(MultiForm):
 class QueryForm(MultiForm):
   def __init__(self):
   def __init__(self):

+ 5 - 1
apps/beeswax/src/beeswax/management/commands/beeswax_install_examples.py

@@ -20,10 +20,10 @@ import csv
 import logging
 import logging
 import json
 import json
 import os
 import os
+import sys
 import pwd
 import pwd
 
 
 from django.core.management.base import BaseCommand
 from django.core.management.base import BaseCommand
-from django.utils.translation import ugettext as _
 
 
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.conf import USE_NEW_EDITOR
 from desktop.conf import USE_NEW_EDITOR
@@ -38,6 +38,10 @@ from beeswax.hive_site import has_concurrency_support
 from beeswax.models import SavedQuery, HQL, IMPALA, RDBMS
 from beeswax.models import SavedQuery, HQL, IMPALA, RDBMS
 from beeswax.server import dbms
 from beeswax.server import dbms
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 2
apps/beeswax/src/beeswax/management/commands/create_table_query_data.py

@@ -18,10 +18,9 @@
 from builtins import str
 from builtins import str
 
 
 import logging
 import logging
+import sys
 
 
 from django.core.management.base import BaseCommand
 from django.core.management.base import BaseCommand
-from django.utils.translation import ugettext as _
-
 
 
 from desktop.lib import django_mako
 from desktop.lib import django_mako
 from beeswax.server import dbms
 from beeswax.server import dbms
@@ -31,6 +30,11 @@ from beeswax.design import hql_query
 from beeswax import hive_site
 from beeswax import hive_site
 from useradmin.models import install_sample_user
 from useradmin.models import install_sample_user
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 1
apps/beeswax/src/beeswax/models.py

@@ -26,7 +26,6 @@ import sys
 from django.db import models
 from django.db import models
 from django.contrib.contenttypes.fields import GenericRelation
 from django.contrib.contenttypes.fields import GenericRelation
 from django.urls import reverse
 from django.urls import reverse
-from django.utils.translation import ugettext as _, ugettext_lazy as _t
 
 
 from enum import Enum
 from enum import Enum
 from TCLIService.ttypes import TSessionHandle, THandleIdentifier, TOperationState, TOperationHandle, TOperationType
 from TCLIService.ttypes import TSessionHandle, THandleIdentifier, TOperationState, TOperationHandle, TOperationType
@@ -39,6 +38,11 @@ from useradmin.models import User
 
 
 from beeswax.design import HQLdesign
 from beeswax.design import HQLdesign
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _, gettext_lazy as _t
+else:
+  from django.utils.translation import ugettext as _, ugettext_lazy as _t
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 2
apps/beeswax/src/beeswax/query_history.py

@@ -21,11 +21,10 @@ from builtins import str
 import collections
 import collections
 import logging
 import logging
 import json
 import json
+import sys
 import threading
 import threading
 import uuid
 import uuid
 
 
-from django.utils.translation import ugettext as _
-
 from beeswax.design import hql_query
 from beeswax.design import hql_query
 from beeswax.server import dbms
 from beeswax.server import dbms
 from beeswax.server.dbms import get_query_server_config
 from beeswax.server.dbms import get_query_server_config
@@ -36,6 +35,11 @@ from desktop.lib import django_mako
 
 
 from useradmin.models import install_sample_user
 from useradmin.models import install_sample_user
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 4 - 1
apps/beeswax/src/beeswax/server/dbms.py

@@ -25,7 +25,6 @@ import json
 
 
 from django.core.cache import caches
 from django.core.cache import caches
 from django.urls import reverse
 from django.urls import reverse
-from django.utils.translation import ugettext as _
 from kazoo.client import KazooClient
 from kazoo.client import KazooClient
 
 
 from desktop.conf import CLUSTER_ID, has_connectors
 from desktop.conf import CLUSTER_ID, has_connectors
@@ -57,6 +56,10 @@ if sys.version_info[0] > 2:
 else:
 else:
   from django.utils.encoding import force_unicode as force_str
   from django.utils.encoding import force_unicode as force_str
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/beeswax/src/beeswax/server/hive_metastore_server.py

@@ -18,10 +18,10 @@
 from builtins import object
 from builtins import object
 import logging
 import logging
 import re
 import re
+import sys
 import thrift
 import thrift
 
 
 from django.utils.encoding import smart_str, force_unicode
 from django.utils.encoding import smart_str, force_unicode
-from django.utils.translation import ugettext as _
 
 
 import hadoop.cluster
 import hadoop.cluster
 
 
@@ -36,6 +36,11 @@ from beeswax.server.hive_server2_lib import ResultCompatible
 from beeswax.models import HiveServerQueryHandle, QueryHistory
 from beeswax.models import HiveServerQueryHandle, QueryHistory
 from beeswax.server.dbms import Table, DataTable
 from beeswax.server.dbms import Table, DataTable
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 1
apps/beeswax/src/beeswax/server/hive_server2_lib.py

@@ -23,7 +23,6 @@ import sys
 
 
 from operator import itemgetter
 from operator import itemgetter
 
 
-from django.utils.translation import ugettext as _
 from TCLIService import TCLIService
 from TCLIService import TCLIService
 from TCLIService.ttypes import TOpenSessionReq, TGetTablesReq, TFetchResultsReq, TStatusCode, TGetResultSetMetadataReq, \
 from TCLIService.ttypes import TOpenSessionReq, TGetTablesReq, TFetchResultsReq, TStatusCode, TGetResultSetMetadataReq, \
   TGetColumnsReq, TTypeId, TExecuteStatementReq, TGetOperationStatusReq, TFetchOrientation, \
   TGetColumnsReq, TTypeId, TExecuteStatementReq, TGetOperationStatusReq, TFetchOrientation, \
@@ -39,6 +38,11 @@ from beeswax.conf import CONFIG_WHITELIST, LIST_PARTITIONS_LIMIT
 from beeswax.models import Session, HiveServerQueryHandle, HiveServerQueryHistory
 from beeswax.models import Session, HiveServerQueryHandle, HiveServerQueryHistory
 from beeswax.server.dbms import Table, DataTable, QueryServerException, InvalidSessionQueryServerException
 from beeswax.server.dbms import Table, DataTable, QueryServerException, InvalidSessionQueryServerException
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 IMPALA_RESULTSET_CACHE_SIZE = 'impala.resultset.cache.size'
 IMPALA_RESULTSET_CACHE_SIZE = 'impala.resultset.cache.size'

+ 6 - 1
apps/beeswax/src/beeswax/templates/beeswax_components.mako

@@ -14,8 +14,13 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.lib.django_util import extract_field_data
   from desktop.lib.django_util import extract_field_data
-  from django.utils.translation import ugettext as _
+  
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%def name="getEllipsifiedCell(val, placement='bottom', klass='')">
 <%def name="getEllipsifiedCell(val, placement='bottom', klass='')">

+ 7 - 1
apps/beeswax/src/beeswax/templates/configuration.mako

@@ -14,8 +14,14 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
+
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="layout" file="layout.mako" />
 <%namespace name="layout" file="layout.mako" />

+ 6 - 1
apps/beeswax/src/beeswax/templates/confirm.mako

@@ -15,7 +15,12 @@
 ## limitations under the License.
 ## limitations under the License.
 
 
 <%!
 <%!
-from django.utils.translation import ugettext as _
+import sys
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <form action="{{ url }}" method="POST">>
 <form action="{{ url }}" method="POST">>

+ 7 - 1
apps/beeswax/src/beeswax/templates/create_database.mako

@@ -14,9 +14,15 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
+
 from desktop import conf
 from desktop import conf
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="beeswax_components.mako" />
 <%namespace name="comps" file="beeswax_components.mako" />

+ 7 - 1
apps/beeswax/src/beeswax/templates/create_table_manually.mako

@@ -14,9 +14,15 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
+
 from desktop import conf
 from desktop import conf
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="beeswax_components.mako" />
 <%namespace name="comps" file="beeswax_components.mako" />

+ 7 - 1
apps/beeswax/src/beeswax/templates/execute.mako

@@ -14,13 +14,19 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
+
   from desktop.lib.django_util import extract_field_data
   from desktop.lib.django_util import extract_field_data
   from desktop.views import commonheader, commonfooter, commonshare, _ko
   from desktop.views import commonheader, commonfooter, commonshare, _ko
   from beeswax import conf as beeswax_conf
   from beeswax import conf as beeswax_conf
   from desktop import conf
   from desktop import conf
   from desktop.conf import USE_NEW_EDITOR
   from desktop.conf import USE_NEW_EDITOR
-  from django.utils.translation import ugettext as _
   from notebook.conf import ENABLE_QUERY_BUILDER
   from notebook.conf import ENABLE_QUERY_BUILDER
+
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="beeswax_components.mako" />
 <%namespace name="comps" file="beeswax_components.mako" />

+ 7 - 1
apps/beeswax/src/beeswax/templates/import_wizard_choose_delimiter.mako

@@ -14,9 +14,15 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
+
 from desktop import conf
 from desktop import conf
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="beeswax_components.mako" />
 <%namespace name="comps" file="beeswax_components.mako" />

+ 7 - 1
apps/beeswax/src/beeswax/templates/import_wizard_choose_file.mako

@@ -14,9 +14,15 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
+
 from desktop import conf
 from desktop import conf
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="beeswax_components.mako" />
 <%namespace name="comps" file="beeswax_components.mako" />

+ 7 - 1
apps/beeswax/src/beeswax/templates/import_wizard_define_columns.mako

@@ -14,9 +14,15 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
+
 from desktop import conf
 from desktop import conf
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="beeswax_components.mako" />
 <%namespace name="comps" file="beeswax_components.mako" />

+ 6 - 1
apps/beeswax/src/beeswax/templates/layout.mako

@@ -15,7 +15,12 @@
 ## limitations under the License.
 ## limitations under the License.
 
 
 <%!
 <%!
-from django.utils.translation import ugettext as _
+import sys
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 def is_selected(section, matcher):
 def is_selected(section, matcher):
   if section == matcher:
   if section == matcher:

+ 2 - 1
apps/beeswax/src/beeswax/templates/list_designs.mako

@@ -17,14 +17,15 @@
     import sys
     import sys
     import time
     import time
     from django.template.defaultfilters import timesince
     from django.template.defaultfilters import timesince
-    from django.utils.translation import ugettext as _
 
 
     from desktop.views import commonheader, commonfooter
     from desktop.views import commonheader, commonfooter
 
 
     if sys.version_info[0] > 2:
     if sys.version_info[0] > 2:
       from django.utils.encoding import force_str
       from django.utils.encoding import force_str
+      from django.utils.translation import gettext as _
     else:
     else:
       from django.utils.encoding import force_unicode as force_str
       from django.utils.encoding import force_unicode as force_str
+      from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />

+ 6 - 1
apps/beeswax/src/beeswax/templates/list_history.mako

@@ -15,11 +15,16 @@
 ## limitations under the License.
 ## limitations under the License.
 
 
 <%!
 <%!
+import sys
 import time
 import time
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
 from beeswax import models
 from beeswax import models
 from beeswax.views import collapse_whitespace
 from beeswax.views import collapse_whitespace
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />

+ 6 - 1
apps/beeswax/src/beeswax/templates/list_trashed_designs.mako

@@ -14,10 +14,15 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+    import sys
     import time
     import time
     from django.template.defaultfilters import timesince
     from django.template.defaultfilters import timesince
     from desktop.views import commonheader, commonfooter
     from desktop.views import commonheader, commonfooter
-    from django.utils.translation import ugettext as _
+
+    if sys.version_info[0] > 2:
+      from django.utils.translation import gettext as _
+    else:
+      from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />

+ 5 - 1
apps/beeswax/src/beeswax/templates/my_queries.mako

@@ -14,12 +14,16 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
 import time
 import time
 from django.template.defaultfilters import timesince
 from django.template.defaultfilters import timesince
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
 from beeswax import models
 from beeswax import models
 from beeswax.views import collapse_whitespace
 from beeswax.views import collapse_whitespace
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />

+ 5 - 1
apps/beeswax/src/beeswax/templates/save_results.mako

@@ -14,10 +14,14 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
 from desktop.lib.django_util import extract_field_data
 from desktop.lib.django_util import extract_field_data
 
 
-from django.utils.translation import ugettext as _
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="layout" file="layout.mako" />
 <%namespace name="layout" file="layout.mako" />

+ 5 - 1
apps/beeswax/src/beeswax/templates/util.mako

@@ -14,7 +14,11 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
-from django.utils.translation import ugettext as _
+import sys
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 <%def name="render_error(err)">
 <%def name="render_error(err)">
   <div>
   <div>

+ 5 - 1
apps/beeswax/src/beeswax/templates/watch_results.mako

@@ -14,10 +14,14 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
 from desktop.lib.i18n import smart_unicode
 from desktop.lib.i18n import smart_unicode
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
 from django.utils.encoding import force_unicode
 from django.utils.encoding import force_unicode
-from django.utils.translation import ugettext as _
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="layout" file="layout.mako" />
 <%namespace name="layout" file="layout.mako" />

+ 5 - 1
apps/beeswax/src/beeswax/views.py

@@ -29,7 +29,6 @@ from django.db.models import Q
 from django.http import HttpResponse, QueryDict
 from django.http import HttpResponse, QueryDict
 from django.shortcuts import redirect
 from django.shortcuts import redirect
 from django.utils.html import escape
 from django.utils.html import escape
-from django.utils.translation import ugettext as _
 from django.urls import reverse
 from django.urls import reverse
 
 
 from desktop.appmanager import get_apps_dict
 from desktop.appmanager import get_apps_dict
@@ -57,6 +56,11 @@ from beeswax.server.dbms import expand_exception, get_query_server_config, Query
 
 
 from desktop.auth.backend import is_admin
 from desktop.auth.backend import is_admin
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

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

@@ -15,12 +15,17 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.utils.translation import ugettext_lazy as _
+import sys
 
 
 from desktop.conf import ENABLE_DOWNLOAD
 from desktop.conf import ENABLE_DOWNLOAD
 from desktop.lib.conf import Config, coerce_bool
 from desktop.lib.conf import Config, coerce_bool
 from desktop.conf import is_oozie_enabled
 from desktop.conf import is_oozie_enabled
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext_lazy as _
+else:
+  from django.utils.translation import ugettext_lazy as _
+
 
 
 MAX_SNAPPY_DECOMPRESSION_SIZE = Config(
 MAX_SNAPPY_DECOMPRESSION_SIZE = Config(
   key="max_snappy_decompression_size",
   key="max_snappy_decompression_size",

+ 2 - 1
apps/filebrowser/src/filebrowser/forms.py

@@ -26,7 +26,6 @@ import urllib.request, urllib.error
 from django import forms
 from django import forms
 from django.forms import FileField, CharField, BooleanField, Textarea
 from django.forms import FileField, CharField, BooleanField, Textarea
 from django.forms.formsets import formset_factory, BaseFormSet
 from django.forms.formsets import formset_factory, BaseFormSet
-from django.utils.translation import ugettext_lazy as _
 
 
 from aws.s3 import S3A_ROOT, normpath as s3_normpath
 from aws.s3 import S3A_ROOT, normpath as s3_normpath
 from azure.abfs.__init__ import ABFS_ROOT, normpath as abfs_normpath
 from azure.abfs.__init__ import ABFS_ROOT, normpath as abfs_normpath
@@ -38,8 +37,10 @@ from filebrowser.lib import rwx
 
 
 if sys.version_info[0] > 2:
 if sys.version_info[0] > 2:
   from urllib.parse import unquote as urllib_unquote
   from urllib.parse import unquote as urllib_unquote
+  from django.utils.translation import gettext_lazy as _
 else:
 else:
   from urllib import unquote as urllib_unquote
   from urllib import unquote as urllib_unquote
+  from django.utils.translation import ugettext_lazy as _
 
 
 
 
 logger = logging.getLogger(__name__)
 logger = logging.getLogger(__name__)

+ 5 - 1
apps/filebrowser/src/filebrowser/lib/archives.py

@@ -27,10 +27,14 @@ import tarfile
 import tempfile
 import tempfile
 
 
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
-from django.utils.translation import ugettext as _
 from filebrowser.conf import ARCHIVE_UPLOAD_TEMPDIR
 from filebrowser.conf import ARCHIVE_UPLOAD_TEMPDIR
 from zipfile import ZipFile
 from zipfile import ZipFile
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 __all__ = ['archive_factory']
 __all__ = ['archive_factory']
 
 

+ 2 - 1
apps/filebrowser/src/filebrowser/templates/display.mako

@@ -21,12 +21,13 @@
   from filebrowser.views import truncate
   from filebrowser.views import truncate
   from desktop.lib.paths import SAFE_CHARACTERS_URI_COMPONENTS
   from desktop.lib.paths import SAFE_CHARACTERS_URI_COMPONENTS
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
 
 
   if sys.version_info[0] > 2:
   if sys.version_info[0] > 2:
     from urllib.parse import quote as urllib_quote
     from urllib.parse import quote as urllib_quote
+    from django.utils.translation import gettext as _
   else:
   else:
     from urllib import quote as urllib_quote
     from urllib import quote as urllib_quote
+    from django.utils.translation import ugettext as _
 %>
 %>
 <%
 <%
   path_enc = urllib_quote(path.encode('utf-8'), safe=SAFE_CHARACTERS_URI_COMPONENTS)
   path_enc = urllib_quote(path.encode('utf-8'), safe=SAFE_CHARACTERS_URI_COMPONENTS)

+ 7 - 1
apps/filebrowser/src/filebrowser/templates/edit.mako

@@ -16,10 +16,16 @@
 
 
 <%!
 <%!
   import datetime
   import datetime
+  import sys
+
   from django.template.defaultfilters import urlencode, stringformat, date, filesizeformat, time
   from django.template.defaultfilters import urlencode, stringformat, date, filesizeformat, time
   from filebrowser.views import truncate
   from filebrowser.views import truncate
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%
 <%

+ 2 - 1
apps/filebrowser/src/filebrowser/templates/fb_components.mako

@@ -19,14 +19,15 @@ import sys
 from desktop.lib.paths import SAFE_CHARACTERS_URI_COMPONENTS
 from desktop.lib.paths import SAFE_CHARACTERS_URI_COMPONENTS
 
 
 from django.template.defaultfilters import urlencode, stringformat, date, filesizeformat, time
 from django.template.defaultfilters import urlencode, stringformat, date, filesizeformat, time
-from django.utils.translation import ugettext as _
 
 
 from aws.conf import get_default_region
 from aws.conf import get_default_region
 
 
 if sys.version_info[0] > 2:
 if sys.version_info[0] > 2:
   from urllib.parse import quote as urllib_quote
   from urllib.parse import quote as urllib_quote
+  from django.utils.translation import gettext as _
 else:
 else:
   from urllib import quote as urllib_quote
   from urllib import quote as urllib_quote
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%def name="breadcrumbs(path, breadcrumbs, from_listdir=False)">
 <%def name="breadcrumbs(path, breadcrumbs, from_listdir=False)">

+ 7 - 1
apps/filebrowser/src/filebrowser/templates/fileop.mako

@@ -15,10 +15,16 @@
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
 import datetime
 import datetime
+import sys
+
 from django import forms
 from django import forms
 from django.template.defaultfilters import urlencode, escape, stringformat, date, filesizeformat, time
 from django.template.defaultfilters import urlencode, escape, stringformat, date, filesizeformat, time
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 
 

+ 6 - 1
apps/filebrowser/src/filebrowser/templates/listdir.mako

@@ -15,12 +15,17 @@
 ## limitations under the License.
 ## limitations under the License.
 
 
 <%!
 <%!
+import sys
+
 from django.template.defaultfilters import urlencode
 from django.template.defaultfilters import urlencode
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
 
 
 from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
 from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />

+ 7 - 1
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -16,12 +16,18 @@
 
 
 <%!
 <%!
 import datetime
 import datetime
+import sys
+
 from django.template.defaultfilters import urlencode, stringformat, filesizeformat, date, time, escape
 from django.template.defaultfilters import urlencode, stringformat, filesizeformat, date, time, escape
 from desktop.lib.django_util import reverse_with_get, extract_field_data
 from desktop.lib.django_util import reverse_with_get, extract_field_data
 from django.utils.encoding import smart_str
 from django.utils.encoding import smart_str
-from django.utils.translation import ugettext as _
 
 
 from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
 from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="edit" file="editor_components.mako" />
 <%namespace name="edit" file="editor_components.mako" />

+ 2 - 1
apps/filebrowser/src/filebrowser/views.py

@@ -43,7 +43,6 @@ from django.shortcuts import redirect
 from functools import partial
 from functools import partial
 from django.utils.http import http_date
 from django.utils.http import http_date
 from django.utils.html import escape
 from django.utils.html import escape
-from django.utils.translation import ugettext as _
 
 
 from aws.s3.s3fs import S3FileSystemException, S3ListAllBucketsException
 from aws.s3.s3fs import S3FileSystemException, S3ListAllBucketsException
 from desktop import appmanager
 from desktop import appmanager
@@ -84,6 +83,7 @@ if sys.version_info[0] > 2:
   from builtins import str as new_str
   from builtins import str as new_str
   from avro import datafile, io
   from avro import datafile, io
   from gzip import decompress as decompress_gzip
   from gzip import decompress as decompress_gzip
+  from django.utils.translation import gettext as _
 else:
 else:
   from cStringIO import StringIO as string_io
   from cStringIO import StringIO as string_io
   from urllib import quote as urllib_quote
   from urllib import quote as urllib_quote
@@ -93,6 +93,7 @@ else:
   import parquet
   import parquet
   from avro import datafile, io
   from avro import datafile, io
   from gzip import GzipFile
   from gzip import GzipFile
+  from django.utils.translation import ugettext as _
 
 
 
 
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB

+ 3 - 5
apps/filebrowser/src/filebrowser/views_test.py

@@ -42,7 +42,6 @@ from aws.s3.s3test_utils import get_test_bucket
 from azure.conf import is_abfs_enabled, is_adls_enabled
 from azure.conf import is_abfs_enabled, is_adls_enabled
 from django.urls import reverse
 from django.urls import reverse
 from django.utils.encoding import smart_str
 from django.utils.encoding import smart_str
-from django.utils.translation import ugettext_lazy as _
 from nose.plugins.attrib import attr
 from nose.plugins.attrib import attr
 from nose.plugins.skip import SkipTest
 from nose.plugins.skip import SkipTest
 from nose.tools import assert_true, assert_false, assert_equal, assert_not_equal, assert_raises,\
 from nose.tools import assert_true, assert_false, assert_equal, assert_not_equal, assert_raises,\
@@ -64,14 +63,13 @@ from filebrowser.views import snappy_installed
 if sys.version_info[0] > 2:
 if sys.version_info[0] > 2:
   from urllib.parse import unquote as urllib_unquote, urlparse
   from urllib.parse import unquote as urllib_unquote, urlparse
   open_file = open
   open_file = open
+  from django.utils.translation import gettext_lazy as _
+  from unittest.mock import patch, Mock
 else:
 else:
   from urllib import unquote as urllib_unquote
   from urllib import unquote as urllib_unquote
   from urlparse import urlparse
   from urlparse import urlparse
   open_file = file
   open_file = file
-
-if sys.version_info[0] > 2:
-  from unittest.mock import patch, Mock
-else:
+  from django.utils.translation import ugettext_lazy as _
   from mock import patch, Mock
   from mock import patch, Mock
 
 
 
 

+ 5 - 1
apps/hbase/src/hbase/api.py

@@ -21,8 +21,8 @@ import json
 import logging
 import logging
 import re
 import re
 import csv
 import csv
+import sys
 
 
-from django.utils.translation import ugettext as _
 from django.utils.encoding import smart_str
 from django.utils.encoding import smart_str
 
 
 from desktop.lib import thrift_util
 from desktop.lib import thrift_util
@@ -32,6 +32,10 @@ from hbase import conf
 from hbase.hbase_site import get_server_principal, get_server_authentication, is_using_thrift_ssl, is_using_thrift_http, get_thrift_transport
 from hbase.hbase_site import get_server_principal, get_server_authentication, is_using_thrift_ssl, is_using_thrift_http, get_thrift_transport
 from hbase.server.hbase_lib import get_thrift_type, get_client_type
 from hbase.server.hbase_lib import get_thrift_type, get_client_type
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 4 - 2
apps/hbase/src/hbase/conf.py

@@ -20,12 +20,14 @@ import logging
 import os
 import os
 import sys
 import sys
 
 
-from django.utils.translation import ugettext_lazy as _t, ugettext as _
-
 from desktop.conf import default_ssl_validate
 from desktop.conf import default_ssl_validate
 from desktop.lib.conf import Config, validate_thrift_transport, coerce_bool
 from desktop.lib.conf import Config, validate_thrift_transport, coerce_bool
 from hbase.hbase_site import get_thrift_transport
 from hbase.hbase_site import get_thrift_transport
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext_lazy as _t, gettext as _
+else:
+  from django.utils.translation import ugettext_lazy as _t, ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 1
apps/hbase/src/hbase/management/commands/hbase_setup.py

@@ -17,11 +17,11 @@
 
 
 import logging
 import logging
 import os
 import os
+import sys
 
 
 from datetime import datetime, timedelta
 from datetime import datetime, timedelta
 
 
 from django.core.management.base import BaseCommand
 from django.core.management.base import BaseCommand
-from django.utils.translation import ugettext as _
 
 
 from desktop.lib.paths import get_apps_root
 from desktop.lib.paths import get_apps_root
 from useradmin.models import install_sample_user, User
 from useradmin.models import install_sample_user, User
@@ -29,6 +29,10 @@ from useradmin.models import install_sample_user, User
 from hbased.ttypes import AlreadyExists
 from hbased.ttypes import AlreadyExists
 from hbase.api import HbaseApi
 from hbase.api import HbaseApi
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/hbase/src/hbase/templates/app.mako

@@ -15,8 +15,13 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />

+ 2 - 2
apps/hbase/src/hbase/views.py

@@ -24,8 +24,6 @@ import re
 import sys
 import sys
 import urllib.request, urllib.parse, urllib.error
 import urllib.request, urllib.parse, urllib.error
 
 
-from django.utils.translation import ugettext as _
-
 from desktop.auth.backend import is_admin
 from desktop.auth.backend import is_admin
 from desktop.lib.django_util import JsonResponse, render
 from desktop.lib.django_util import JsonResponse, render
 
 
@@ -38,9 +36,11 @@ from hbase.server.hbase_lib import get_thrift_type
 
 
 if sys.version_info[0] > 2:
 if sys.version_info[0] > 2:
   from io import StringIO as string_io
   from io import StringIO as string_io
+  from django.utils.translation import gettext as _
 else:
 else:
   from cStringIO import StringIO as string_io
   from cStringIO import StringIO as string_io
   from avro import datafile, io
   from avro import datafile, io
+  from django.utils.translation import ugettext as _
 
 
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)

+ 4 - 2
apps/hive/src/hive/conf.py

@@ -20,12 +20,14 @@ import sys
 
 
 import beeswax.hive_site
 import beeswax.hive_site
 
 
-from django.utils.translation import ugettext_lazy as _t, ugettext as _
-
 from desktop.conf import has_connectors
 from desktop.conf import has_connectors
 from desktop.lib.exceptions import StructuredThriftTransportException
 from desktop.lib.exceptions import StructuredThriftTransportException
 from beeswax.settings import NICE_NAME
 from beeswax.settings import NICE_NAME
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext_lazy as _t, gettext as _
+else:
+  from django.utils.translation import ugettext_lazy as _t, ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/impala/src/impala/api.py

@@ -21,8 +21,8 @@ import base64
 import logging
 import logging
 import json
 import json
 import struct
 import struct
+import sys
 
 
-from django.utils.translation import ugettext as _
 from django.views.decorators.http import require_POST
 from django.views.decorators.http import require_POST
 
 
 from beeswax.api import error_handler
 from beeswax.api import error_handler
@@ -42,6 +42,11 @@ from libanalyze import analyze as analyzer, rules
 
 
 from notebook.models import make_notebook
 from notebook.models import make_notebook
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 ANALYZER = rules.TopDownAnalysis() # We need to parse some files so save as global
 ANALYZER = rules.TopDownAnalysis() # We need to parse some files so save as global

+ 4 - 2
apps/impala/src/impala/conf.py

@@ -20,8 +20,6 @@ import os
 import socket
 import socket
 import sys
 import sys
 
 
-from django.utils.translation import ugettext_lazy as _t, ugettext as _
-
 from desktop.conf import default_ssl_cacerts, default_ssl_validate, AUTH_USERNAME as DEFAULT_AUTH_USERNAME, \
 from desktop.conf import default_ssl_cacerts, default_ssl_validate, AUTH_USERNAME as DEFAULT_AUTH_USERNAME, \
     AUTH_PASSWORD as DEFAULT_AUTH_PASSWORD, has_connectors
     AUTH_PASSWORD as DEFAULT_AUTH_PASSWORD, has_connectors
 from desktop.lib.conf import ConfigSection, Config, coerce_bool, coerce_csv, coerce_password_from_script
 from desktop.lib.conf import ConfigSection, Config, coerce_bool, coerce_csv, coerce_password_from_script
@@ -31,6 +29,10 @@ from desktop.lib.paths import get_desktop_root
 from impala.impala_flags import get_max_result_cache_size, is_impersonation_enabled, is_kerberos_enabled, is_webserver_spnego_enabled
 from impala.impala_flags import get_max_result_cache_size, is_impersonation_enabled, is_kerberos_enabled, is_webserver_spnego_enabled
 from impala.settings import NICE_NAME
 from impala.settings import NICE_NAME
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext_lazy as _t, gettext as _
+else:
+  from django.utils.translation import ugettext_lazy as _t, ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 2
apps/impala/src/impala/dbms.py

@@ -16,8 +16,7 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
-
-from django.utils.translation import ugettext as _
+import sys
 
 
 from desktop.conf import CLUSTER_ID, has_connectors
 from desktop.conf import CLUSTER_ID, has_connectors
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
@@ -32,6 +31,11 @@ from beeswax.server.dbms import HiveServer2Dbms, QueryServerException, QueryServ
 from impala import conf
 from impala import conf
 from impala.impala_flags import get_hs2_http_port
 from impala.impala_flags import get_hs2_http_port
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 2
apps/impala/src/impala/server.py

@@ -20,8 +20,7 @@ from builtins import object
 import json
 import json
 import logging
 import logging
 import threading
 import threading
-
-from django.utils.translation import ugettext as _
+import sys
 
 
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.rest.http_client import HttpClient
 from desktop.lib.rest.http_client import HttpClient
@@ -33,6 +32,10 @@ from ImpalaService import ImpalaHiveServer2Service
 from impala.impala_flags import get_webserver_certificate_file, is_webserver_spnego_enabled, is_kerberos_enabled
 from impala.impala_flags import get_webserver_certificate_file, is_webserver_spnego_enabled, is_kerberos_enabled
 from impala.conf import DAEMON_API_USERNAME, DAEMON_API_PASSWORD, DAEMON_API_AUTH_SCHEME, COORDINATOR_URL
 from impala.conf import DAEMON_API_USERNAME, DAEMON_API_PASSWORD, DAEMON_API_AUTH_SCHEME, COORDINATOR_URL
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 1
apps/jobbrowser/src/jobbrowser/api.py

@@ -17,10 +17,10 @@
 
 
 from builtins import object
 from builtins import object
 import logging
 import logging
+import sys
 
 
 from datetime import datetime, timedelta
 from datetime import datetime, timedelta
 from django.core.paginator import Paginator
 from django.core.paginator import Paginator
-from django.utils.translation import ugettext as _
 
 
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.rest.http_client import RestException
 from desktop.lib.rest.http_client import RestException
@@ -38,6 +38,10 @@ from jobbrowser.conf import SHARE_JOBS
 from jobbrowser.yarn_models import Application, YarnV2Job, Job as YarnJob, KilledJob as KilledYarnJob, Container, SparkJob
 from jobbrowser.yarn_models import Application, YarnV2Job, Job as YarnJob, KilledJob as KilledYarnJob, Container, SparkJob
 from desktop.auth.backend import is_admin
 from desktop.auth.backend import is_admin
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/jobbrowser/src/jobbrowser/api2.py

@@ -17,11 +17,11 @@
 
 
 import json
 import json
 import logging
 import logging
+import sys
 
 
 from urllib.request import Request, urlopen
 from urllib.request import Request, urlopen
 
 
 from django.http import HttpResponse
 from django.http import HttpResponse
-from django.utils.translation import ugettext as _
 
 
 from desktop.lib.i18n import smart_unicode
 from desktop.lib.i18n import smart_unicode
 from desktop.lib.django_util import JsonResponse
 from desktop.lib.django_util import JsonResponse
@@ -32,6 +32,11 @@ from jobbrowser.apis.query_store import query_store_proxy, stream_download_bundl
 
 
 from jobbrowser.conf import DISABLE_KILLING_JOBS, USE_PROXY
 from jobbrowser.conf import DISABLE_KILLING_JOBS, USE_PROXY
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 
 
 

+ 5 - 2
apps/jobbrowser/src/jobbrowser/apis/base_api.py

@@ -19,12 +19,15 @@ from builtins import object
 import logging
 import logging
 import posixpath
 import posixpath
 import re
 import re
-
-from django.utils.translation import ugettext as _
+import sys
 
 
 from hadoop.fs.hadoopfs import Hdfs
 from hadoop.fs.hadoopfs import Hdfs
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 2
apps/jobbrowser/src/jobbrowser/apis/beat_api.py

@@ -16,16 +16,19 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
+import sys
 
 
 from datetime import datetime
 from datetime import datetime
 
 
-from django.utils.translation import ugettext as _
-
 from dateutil import parser
 from dateutil import parser
 from desktop.lib.scheduler.lib.beat import CeleryBeatApi
 from desktop.lib.scheduler.lib.beat import CeleryBeatApi
 
 
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 2
apps/jobbrowser/src/jobbrowser/apis/beeswax_query_api.py

@@ -18,16 +18,20 @@ from builtins import filter
 
 
 import logging
 import logging
 import re
 import re
+import sys
 
 
 from datetime import datetime
 from datetime import datetime
 
 
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.python_util import current_ms_from_utc
 from desktop.lib.python_util import current_ms_from_utc
 
 
-from django.utils.translation import ugettext as _
-
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 
 try:
 try:

+ 5 - 2
apps/jobbrowser/src/jobbrowser/apis/bundle_api.py

@@ -17,8 +17,7 @@
 
 
 import logging
 import logging
 import json
 import json
-
-from django.utils.translation import ugettext as _
+import sys
 
 
 from liboozie.oozie_api import get_oozie
 from liboozie.oozie_api import get_oozie
 
 
@@ -26,6 +25,10 @@ from jobbrowser.apis.base_api import Api, MockDjangoRequest
 from jobbrowser.apis.workflow_api import _manage_oozie_job, _filter_oozie_jobs
 from jobbrowser.apis.workflow_api import _manage_oozie_job, _filter_oozie_jobs
 from jobbrowser.apis.schedule_api import MockGet
 from jobbrowser.apis.schedule_api import MockGet
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 1
apps/jobbrowser/src/jobbrowser/apis/clusters.py

@@ -16,17 +16,21 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
+import sys
 
 
 from datetime import datetime
 from datetime import datetime
 from dateutil import parser
 from dateutil import parser
 
 
 from django.utils import timezone
 from django.utils import timezone
-from django.utils.translation import ugettext as _
 
 
 from notebook.connectors.altus import DataWarehouse2Api
 from notebook.connectors.altus import DataWarehouse2Api
 
 
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)

+ 5 - 2
apps/jobbrowser/src/jobbrowser/apis/data_eng_api.py

@@ -16,15 +16,18 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
+import sys
 
 
 from datetime import datetime,  timedelta
 from datetime import datetime,  timedelta
 
 
-from django.utils.translation import ugettext as _
-
 from notebook.connectors.altus import DataEngApi, DATE_FORMAT
 from notebook.connectors.altus import DataEngApi, DATE_FORMAT
 
 
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 1
apps/jobbrowser/src/jobbrowser/apis/data_warehouse.py

@@ -16,17 +16,21 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
+import sys
 
 
 from datetime import datetime
 from datetime import datetime
 from dateutil import parser
 from dateutil import parser
 
 
 from django.utils import timezone
 from django.utils import timezone
-from django.utils.translation import ugettext as _
 
 
 from notebook.connectors.altus import AnalyticDbApi, DataWarehouse2Api
 from notebook.connectors.altus import AnalyticDbApi, DataWarehouse2Api
 
 
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)

+ 6 - 2
apps/jobbrowser/src/jobbrowser/apis/history.py

@@ -16,12 +16,11 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
+import sys
 
 
 from datetime import datetime
 from datetime import datetime
 from dateutil import parser
 from dateutil import parser
 
 
-from django.utils.translation import ugettext as _
-
 from desktop.models import Document2
 from desktop.models import Document2
 from notebook.api import _get_statement
 from notebook.api import _get_statement
 from notebook.models import Notebook
 from notebook.models import Notebook
@@ -29,6 +28,11 @@ from notebook.models import Notebook
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 from jobbrowser.conf import MAX_JOB_FETCH
 from jobbrowser.conf import MAX_JOB_FETCH
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/jobbrowser/src/jobbrowser/apis/hive_query_api.py

@@ -18,9 +18,9 @@ from builtins import filter
 
 
 import logging
 import logging
 from logging import exception
 from logging import exception
+import sys
 
 
 from datetime import datetime
 from datetime import datetime
-from django.utils.translation import ugettext as _
 
 
 from beeswax.models import QueryHistory
 from beeswax.models import QueryHistory
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
@@ -34,6 +34,11 @@ from jobbrowser.apis.base_api import Api
 from jobbrowser.conf import QUERY_STORE
 from jobbrowser.conf import QUERY_STORE
 from jobbrowser.models import HiveQuery
 from jobbrowser.models import HiveQuery
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/jobbrowser/src/jobbrowser/apis/job_api.py

@@ -17,9 +17,9 @@
 
 
 import json
 import json
 import logging
 import logging
+import sys
 
 
 from django.utils.encoding import smart_str
 from django.utils.encoding import smart_str
-from django.utils.translation import ugettext as _
 from hadoop.yarn import resource_manager_api
 from hadoop.yarn import resource_manager_api
 
 
 from desktop.lib.django_util import JsonResponse
 from desktop.lib.django_util import JsonResponse
@@ -28,6 +28,11 @@ from desktop.lib.exceptions_renderable import PopupException
 from jobbrowser.conf import MAX_JOB_FETCH, LOG_OFFSET
 from jobbrowser.conf import MAX_JOB_FETCH, LOG_OFFSET
 from jobbrowser.views import job_executor_logs, job_single_logs
 from jobbrowser.views import job_executor_logs, job_single_logs
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 LOG_OFFSET_BYTES = LOG_OFFSET.get()
 LOG_OFFSET_BYTES = LOG_OFFSET.get()

+ 5 - 2
apps/jobbrowser/src/jobbrowser/apis/livy_api.py

@@ -16,13 +16,16 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
-
-from django.utils.translation import ugettext as _
+import sys
 
 
 from spark.livy_client import get_api
 from spark.livy_client import get_api
 
 
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 2
apps/jobbrowser/src/jobbrowser/apis/query_api.py

@@ -20,17 +20,21 @@ from builtins import range
 import itertools
 import itertools
 import logging
 import logging
 import re
 import re
+import sys
 import time
 import time
 from datetime import datetime
 from datetime import datetime
 
 
-from django.utils.translation import ugettext as _
-
 from desktop.lib import export_csvxls
 from desktop.lib import export_csvxls
 from libanalyze import analyze as analyzer, rules
 from libanalyze import analyze as analyzer, rules
 from notebook.conf import ENABLE_QUERY_ANALYSIS
 from notebook.conf import ENABLE_QUERY_ANALYSIS
 
 
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 ANALYZER = rules.TopDownAnalysis() # We need to parse some files so save as global
 ANALYZER = rules.TopDownAnalysis() # We need to parse some files so save as global
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 2
apps/jobbrowser/src/jobbrowser/apis/schedule_api.py

@@ -18,8 +18,7 @@
 from builtins import object
 from builtins import object
 import logging
 import logging
 import json
 import json
-
-from django.utils.translation import ugettext as _
+import sys
 
 
 from liboozie.oozie_api import get_oozie
 from liboozie.oozie_api import get_oozie
 from liboozie.utils import format_time
 from liboozie.utils import format_time
@@ -27,6 +26,11 @@ from liboozie.utils import format_time
 from jobbrowser.apis.base_api import Api, MockDjangoRequest
 from jobbrowser.apis.base_api import Api, MockDjangoRequest
 from jobbrowser.apis.workflow_api import _manage_oozie_job, _filter_oozie_jobs
 from jobbrowser.apis.workflow_api import _manage_oozie_job, _filter_oozie_jobs
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 2
apps/jobbrowser/src/jobbrowser/apis/schedule_hive.py

@@ -16,16 +16,19 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
+import sys
 
 
 from datetime import datetime
 from datetime import datetime
 
 
-from django.utils.translation import ugettext as _
-
 from dateutil import parser
 from dateutil import parser
 from desktop.lib.scheduler.lib.hive import HiveSchedulerApi
 from desktop.lib.scheduler.lib.hive import HiveSchedulerApi
 
 
 from jobbrowser.apis.base_api import Api
 from jobbrowser.apis.base_api import Api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 2
apps/jobbrowser/src/jobbrowser/apis/workflow_api.py

@@ -17,12 +17,15 @@
 
 
 import logging
 import logging
 import json
 import json
-
-from django.utils.translation import ugettext as _
+import sys
 
 
 from jobbrowser.apis.base_api import Api, MockDjangoRequest, _extract_query_params, is_linkable, hdfs_link_js
 from jobbrowser.apis.base_api import Api, MockDjangoRequest, _extract_query_params, is_linkable, hdfs_link_js
 from liboozie.oozie_api import get_oozie
 from liboozie.oozie_api import get_oozie
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/jobbrowser/src/jobbrowser/conf.py

@@ -15,10 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.utils.translation import ugettext_lazy as _
+import sys
 
 
 from desktop.lib.conf import Config, coerce_bool, ConfigSection
 from desktop.lib.conf import Config, coerce_bool, ConfigSection
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext_lazy as _
+else:
+  from django.utils.translation import ugettext_lazy as _
+
 
 
 SHARE_JOBS = Config(
 SHARE_JOBS = Config(
   key='share_jobs',
   key='share_jobs',

+ 6 - 1
apps/jobbrowser/src/jobbrowser/models.py

@@ -23,11 +23,11 @@ import logging
 import math
 import math
 import functools
 import functools
 import re
 import re
+import sys
 
 
 from django.db import connection, models
 from django.db import connection, models
 from django.urls import reverse
 from django.urls import reverse
 from django.utils.html import escape
 from django.utils.html import escape
-from django.utils.translation import ugettext as _
 
 
 from desktop.auth.backend import is_admin
 from desktop.auth.backend import is_admin
 from desktop.conf import REST_CONN_TIMEOUT
 from desktop.conf import REST_CONN_TIMEOUT
@@ -36,6 +36,11 @@ from desktop.lib.view_util import format_duration_in_millis, location_to_url
 
 
 from jobbrowser.conf import DISABLE_KILLING_JOBS
 from jobbrowser.conf import DISABLE_KILLING_JOBS
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/attempt.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />
 
 

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/attempt_logs.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />
 
 

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/container.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />

+ 6 - 1
apps/jobbrowser/src/jobbrowser/templates/job.mako

@@ -18,13 +18,18 @@
 
 
 <%!
 <%!
   import os
   import os
+  import sys
   from hadoop.fs.exceptions import WebHdfsException
   from hadoop.fs.exceptions import WebHdfsException
   from jobbrowser.views import format_counter_name
   from jobbrowser.views import format_counter_name
   from desktop.lib.view_util import location_to_url
   from desktop.lib.view_util import location_to_url
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
   from django.template.defaultfilters import urlencode
   from django.template.defaultfilters import urlencode
-  from django.utils.translation import ugettext as _
   from six import iteritems
   from six import iteritems
+
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 <%def name="task_table(dom_id, tasks)">
 <%def name="task_table(dom_id, tasks)">
     <table id="${ dom_id }" class="taskTable table table-condensed">
     <table id="${ dom_id }" class="taskTable table table-condensed">

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/job_attempt_logs.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />

+ 6 - 1
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -14,7 +14,7 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%
 <%
-from django.utils.translation import ugettext as _
+import sys
 
 
 from desktop.conf import CUSTOM, IS_K8S_ONLY
 from desktop.conf import CUSTOM, IS_K8S_ONLY
 from desktop.views import commonheader, commonfooter, _ko
 from desktop.views import commonheader, commonfooter, _ko
@@ -26,6 +26,11 @@ from notebook.conf import ENABLE_QUERY_SCHEDULING
 from jobbrowser.conf import DISABLE_KILLING_JOBS, MAX_JOB_FETCH, ENABLE_QUERY_BROWSER, ENABLE_HIVE_QUERY_BROWSER, ENABLE_QUERIES_LIST, ENABLE_HISTORY_V2
 from jobbrowser.conf import DISABLE_KILLING_JOBS, MAX_JOB_FETCH, ENABLE_QUERY_BROWSER, ENABLE_HIVE_QUERY_BROWSER, ENABLE_QUERIES_LIST, ENABLE_HISTORY_V2
 
 
 from webpack_loader.templatetags.webpack_loader import render_bundle
 from webpack_loader.templatetags.webpack_loader import render_bundle
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%
 <%

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/job_not_assigned.mako

@@ -17,10 +17,14 @@
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />
 
 
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
 
 
   from django.template.defaultfilters import urlencode
   from django.template.defaultfilters import urlencode
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 ${ commonheader(_('Job'), "jobbrowser", user, request) | n,unicode }
 ${ commonheader(_('Job'), "jobbrowser", user, request) | n,unicode }

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/jobbrowser_components.mako

@@ -14,7 +14,11 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
-    from django.utils.translation import ugettext as _
+    import sys
+    if sys.version_info[0] > 2:
+        from django.utils.translation import gettext as _
+    else:
+        from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%def name="task_counters(counters)">
 <%def name="task_counters(counters)">

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/jobs.mako

@@ -14,10 +14,14 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%
 <%
+  import sys
   from jobbrowser.views import get_state_link
   from jobbrowser.views import get_state_link
   from django.template.defaultfilters import urlencode
   from django.template.defaultfilters import urlencode
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="components" file="jobbrowser_components.mako" />
 <%namespace name="components" file="jobbrowser_components.mako" />

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/task.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />
 
 

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/tasks.mako

@@ -14,9 +14,13 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%
 <%
+  import sys
   from jobbrowser.views import get_state_link
   from jobbrowser.views import get_state_link
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/tasktracker.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templates/tasktrackers.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from desktop.views import commonheader, commonfooter
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="comps" file="jobbrowser_components.mako" />
 <%namespace name="comps" file="jobbrowser_components.mako" />

+ 5 - 1
apps/jobbrowser/src/jobbrowser/templatetags/unix_ms_to_datetime.py

@@ -19,8 +19,12 @@ from __future__ import division
 import datetime
 import datetime
 import django
 import django
 import math
 import math
+import sys
 
 
-from django.utils.translation import ugettext as _
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 register = django.template.Library()
 register = django.template.Library()
 
 

+ 4 - 1
apps/jobbrowser/src/jobbrowser/views.py

@@ -34,7 +34,6 @@ from urllib.parse import quote_plus
 
 
 from django.http import HttpResponseRedirect
 from django.http import HttpResponseRedirect
 from django.utils.functional import wraps
 from django.utils.functional import wraps
-from django.utils.translation import ugettext as _
 from django.urls import reverse
 from django.urls import reverse
 
 
 from desktop.auth.backend import is_admin
 from desktop.auth.backend import is_admin
@@ -51,6 +50,10 @@ from hadoop import cluster
 from hadoop.yarn.clients import get_log_client
 from hadoop.yarn.clients import get_log_client
 from hadoop.yarn import resource_manager_api as resource_manager_api
 from hadoop.yarn import resource_manager_api as resource_manager_api
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 4
apps/jobbrowser/src/jobbrowser/yarn_models.py

@@ -24,13 +24,12 @@ import logging
 import math
 import math
 import os
 import os
 import re
 import re
+import sys
 import time
 import time
 import urllib.parse
 import urllib.parse
 
 
 from lxml import html
 from lxml import html
 
 
-from django.utils.translation import ugettext as _
-
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.rest.http_client import HttpClient
 from desktop.lib.rest.http_client import HttpClient
 from desktop.lib.rest.resource import Resource
 from desktop.lib.rest.resource import Resource
@@ -39,10 +38,12 @@ from desktop.lib.view_util import big_filesizeformat, format_duration_in_millis
 from hadoop import cluster
 from hadoop import cluster
 from hadoop.yarn.clients import get_log_client
 from hadoop.yarn.clients import get_log_client
 
 
-
-
 from jobbrowser.models import format_unixtime_ms
 from jobbrowser.models import format_unixtime_ms
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
apps/jobsub/src/jobsub/conf.py

@@ -16,10 +16,15 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import os.path
 import os.path
+import sys
 
 
 from desktop.lib.conf import Config
 from desktop.lib.conf import Config
 from desktop.lib import paths
 from desktop.lib import paths
-from django.utils.translation import ugettext_lazy as _
+
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext_lazy as _
+else:
+  from django.utils.translation import ugettext_lazy as _
 
 
 
 
 LOCAL_DATA_DIR = Config(
 LOCAL_DATA_DIR = Config(

+ 5 - 1
apps/jobsub/src/jobsub/forms.py

@@ -17,13 +17,17 @@
 
 
 from builtins import object
 from builtins import object
 import logging
 import logging
+import sys
 
 
 from django import forms
 from django import forms
 
 
 from desktop.lib.django_forms import MultiForm
 from desktop.lib.django_forms import MultiForm
 from jobsub import models
 from jobsub import models
 
 
-from django.utils.translation import ugettext as _
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 5 - 1
apps/jobsub/src/jobsub/models.py

@@ -17,14 +17,18 @@
 
 
 from builtins import str
 from builtins import str
 import logging
 import logging
+import sys
 
 
 from django.db import models
 from django.db import models
 from django.urls import reverse
 from django.urls import reverse
-from django.utils.translation import ugettext_lazy as _
 
 
 from desktop.lib.parameterization import find_parameters, bind_parameters
 from desktop.lib.parameterization import find_parameters, bind_parameters
 from useradmin.models import User
 from useradmin.models import User
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext_lazy as _
+else:
+  from django.utils.translation import ugettext_lazy as _
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 7 - 1
apps/jobsub/src/jobsub/old_migrations/0005_unify_with_oozie.py

@@ -1,13 +1,19 @@
 # encoding: utf-8
 # encoding: utf-8
 import datetime
 import datetime
+import sys
+
 from django.contrib.auth.models import User
 from django.contrib.auth.models import User
-from django.utils.translation import ugettext as _
 from south.db import db
 from south.db import db
 from south.v2 import DataMigration
 from south.v2 import DataMigration
 from django.db import models
 from django.db import models
 from oozie.importlib.jobdesigner import convert_jobsub_design
 from oozie.importlib.jobdesigner import convert_jobsub_design
 from oozie.models import Workflow, Kill, Start, End
 from oozie.models import Workflow, Kill, Start, End
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 class Migration(DataMigration):
 class Migration(DataMigration):
     depends_on = (
     depends_on = (

+ 7 - 1
apps/jobsub/src/jobsub/old_migrations/0006_chg_varchars_to_textfields.py

@@ -1,10 +1,16 @@
 # -*- coding: utf-8 -*-
 # -*- coding: utf-8 -*-
 import datetime
 import datetime
-from django.utils.translation import ugettext as _
+import sys
+
 from south.db import db
 from south.db import db
 from south.v2 import SchemaMigration
 from south.v2 import SchemaMigration
 from django.db import models
 from django.db import models
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 
 
 class Migration(SchemaMigration):
 class Migration(SchemaMigration):
 
 

+ 5 - 1
apps/jobsub/src/jobsub/templates/designs.mako

@@ -15,9 +15,13 @@
 
 
 <%!
 <%!
 import cgi
 import cgi
+import sys
 import time
 import time
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />

+ 5 - 1
apps/jobsub/src/jobsub/templates/not_available.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+import sys
 from desktop.views import commonheader, commonfooter
 from desktop.views import commonheader, commonfooter
-from django.utils.translation import ugettext as _
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <link rel="stylesheet" href="${ static('desktop/css/httperrors.css') }">
 <link rel="stylesheet" href="${ static('desktop/css/httperrors.css') }">

+ 6 - 2
apps/jobsub/src/jobsub/views.py

@@ -27,10 +27,9 @@ is a "job submission".  Submissions can be "watched".
 
 
 from builtins import str
 from builtins import str
 import logging
 import logging
+import sys
 import time as py_time
 import time as py_time
 
 
-from django.utils.translation import ugettext as _
-
 from desktop import appmanager
 from desktop import appmanager
 from desktop.lib.django_util import render, render_json
 from desktop.lib.django_util import render, render_json
 from desktop.lib.exceptions import StructuredException
 from desktop.lib.exceptions import StructuredException
@@ -45,6 +44,11 @@ from oozie.utils import model_to_dict, format_dict_field_values,\
 
 
 from desktop.auth.backend import is_admin
 from desktop.auth.backend import is_admin
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _
+else:
+  from django.utils.translation import ugettext as _
+
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 MAX_DESIGNS = 250
 MAX_DESIGNS = 250
 
 

+ 6 - 1
apps/metastore/src/metastore/conf.py

@@ -15,10 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.utils.translation import ugettext_lazy as _
+import sys
 
 
 from desktop.lib.conf import Config
 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 _
+
 
 
 ENABLE_NEW_CREATE_TABLE = Config(
 ENABLE_NEW_CREATE_TABLE = Config(
   key="enable_new_create_table",
   key="enable_new_create_table",

+ 7 - 1
apps/metastore/src/metastore/forms.py

@@ -15,8 +15,9 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
+import sys
+
 from django import forms
 from django import forms
-from django.utils.translation import ugettext as _, ugettext_lazy as _t
 
 
 from desktop.lib.django_forms import simple_formset_factory, DependencyAwareForm
 from desktop.lib.django_forms import simple_formset_factory, DependencyAwareForm
 from desktop.lib.django_forms import ChoiceOrOtherField, MultiForm, SubmitButton
 from desktop.lib.django_forms import ChoiceOrOtherField, MultiForm, SubmitButton
@@ -25,6 +26,11 @@ from filebrowser.forms import PathField
 from beeswax import common
 from beeswax import common
 from beeswax.models import SavedQuery
 from beeswax.models import SavedQuery
 
 
+if sys.version_info[0] > 2:
+  from django.utils.translation import gettext as _, gettext_lazy as _t
+else:
+  from django.utils.translation import ugettext as _, ugettext_lazy as _t
+
 
 
 class DbForm(forms.Form):
 class DbForm(forms.Form):
   """For 'show tables'"""
   """For 'show tables'"""

+ 5 - 1
apps/metastore/src/metastore/templates/components.mako

@@ -14,8 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## limitations under the License.
 <%!
 <%!
+  import sys
   from desktop.lib.django_util import extract_field_data
   from desktop.lib.django_util import extract_field_data
-  from django.utils.translation import ugettext as _
+  if sys.version_info[0] > 2:
+    from django.utils.translation import gettext as _
+  else:
+    from django.utils.translation import ugettext as _
 %>
 %>
 
 
 <%def name="menubar(is_embeddable=False)">
 <%def name="menubar(is_embeddable=False)">

Some files were not shown because too many files changed in this diff