Browse Source

HUE-3287 [core] Django 1.11 upgrade
- To upgrade Django 1.9, following changes are needed:
- rename request.REQUEST.get to request.GET.get
- adding django context processor
- adding urls.py for hue/accounts/login?next=/
- no TEMPLATE_ variable in "settings.py"
- fixing "request" dict population
- fixing login url rule in desktop/core/src/desktop/urls.py

Prakash Ranade 8 years ago
parent
commit
87210cc03c

+ 3 - 3
apps/beeswax/src/beeswax/create_table.py

@@ -253,7 +253,7 @@ def import_wizard(request, database='default'):
                 'file_format': 'TextFile',
                 'file_format': 'TextFile',
                 'load_data': load_data,
                 'load_data': load_data,
                 'path': path,
                 'path': path,
-                'skip_header': request.REQUEST.get('removeHeader', 'off').lower() == 'on'
+                'skip_header': request.GET.get('removeHeader', 'off').lower() == 'on'
              },
              },
             'columns': [ f.cleaned_data for f in s3_col_formset.forms ],
             'columns': [ f.cleaned_data for f in s3_col_formset.forms ],
             'partition_columns': [],
             'partition_columns': [],
@@ -482,8 +482,8 @@ def load_after_create(request, database):
   We get here from the create's on_success_url, and expect to find
   We get here from the create's on_success_url, and expect to find
   ``table`` and ``path`` from the parameters.
   ``table`` and ``path`` from the parameters.
   """
   """
-  tablename = request.REQUEST.get('table')
-  path = request.REQUEST.get('path')
+  tablename = request.GET.get('table')
+  path = request.GET.get('path')
 
 
   if not tablename or not path:
   if not tablename or not path:
     msg = _('Internal error: Missing needed parameter to load data into table.')
     msg = _('Internal error: Missing needed parameter to load data into table.')

+ 4 - 4
apps/filebrowser/src/filebrowser/views.py

@@ -261,7 +261,7 @@ def edit(request, path, form=None):
         raise PopupException(_("File too big to edit: %(path)s") % {'path': path})
         raise PopupException(_("File too big to edit: %(path)s") % {'path': path})
 
 
     if not form:
     if not form:
-        encoding = request.REQUEST.get('encoding') or i18n.get_site_encoding()
+        encoding = request.GET.get('encoding') or i18n.get_site_encoding()
         if stats:
         if stats:
             f = request.fs.open(path)
             f = request.fs.open(path)
             try:
             try:
@@ -349,7 +349,7 @@ def listdir(request, path):
     if not request.fs.isdir(path):
     if not request.fs.isdir(path):
         raise PopupException(_("Not a directory: %(path)s") % {'path': path})
         raise PopupException(_("Not a directory: %(path)s") % {'path': path})
 
 
-    file_filter = request.REQUEST.get('file_filter', 'any')
+    file_filter = request.GET.get('file_filter', 'any')
 
 
     assert file_filter in ['any', 'file', 'dir']
     assert file_filter in ['any', 'file', 'dir']
 
 
@@ -369,7 +369,7 @@ def listdir(request, path):
         'groups': request.user.username == request.fs.superuser and [str(x) for x in Group.objects.values_list('name', flat=True)] or [],
         'groups': request.user.username == request.fs.superuser and [str(x) for x in Group.objects.values_list('name', flat=True)] or [],
         'users': request.user.username == request.fs.superuser and [str(x) for x in User.objects.values_list('username', flat=True)] or [],
         'users': request.user.username == request.fs.superuser and [str(x) for x in User.objects.values_list('username', flat=True)] or [],
         'superuser': request.fs.superuser,
         'superuser': request.fs.superuser,
-        'show_upload': (request.REQUEST.get('show_upload') == 'false' and (False,) or (True,))[0],
+        'show_upload': (request.GET.get('show_upload') == 'false' and (False,) or (True,))[0],
         'show_download_button': SHOW_DOWNLOAD_BUTTON.get(),
         'show_download_button': SHOW_DOWNLOAD_BUTTON.get(),
         'show_upload_button': SHOW_UPLOAD_BUTTON.get(),
         'show_upload_button': SHOW_UPLOAD_BUTTON.get(),
         'is_embeddable': request.GET.get('is_embeddable', False),
         'is_embeddable': request.GET.get('is_embeddable', False),
@@ -1037,7 +1037,7 @@ def generic_op(form_class, request, op, parameter_names, piggyback=None, templat
         ret['extra_params'] = extra_params
         ret['extra_params'] = extra_params
 
 
     for p in parameter_names:
     for p in parameter_names:
-        val = request.REQUEST.get(p)
+        val = request.GET.get(p)
         if val:
         if val:
             ret[p] = val
             ret[p] = val
 
 

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

@@ -74,7 +74,7 @@ def api_router(request, url): # On split, deserialize anything
                 for arg in decoded_url_params] # Deserialize later
                 for arg in decoded_url_params] # Deserialize later
 
 
   if request.POST.get('dest', False):
   if request.POST.get('dest', False):
-    url_params += [request.FILES.get(request.REQUEST.get('dest'))]
+    url_params += [request.FILES.get(request.GET.get('dest'))]
 
 
   return api_dump(HbaseApi(request.user).query(*url_params))
   return api_dump(HbaseApi(request.user).query(*url_params))
 
 

+ 5 - 5
apps/jobbrowser/src/jobbrowser/views.py

@@ -219,7 +219,7 @@ def massage_task_for_json(task):
 
 
 
 
 def single_spark_job(request, job):
 def single_spark_job(request, job):
-  if request.REQUEST.get('format') == 'json':
+  if request.GET.get('format') == 'json':
     json_job = {
     json_job = {
       'job': massage_job_for_json(job, request)
       'job': massage_job_for_json(job, request)
     }
     }
@@ -243,7 +243,7 @@ def single_job(request, job):
   recent_tasks = job.filter_tasks(task_states=('running', 'succeeded',))
   recent_tasks = job.filter_tasks(task_states=('running', 'succeeded',))
   recent_tasks.sort(cmp_exec_time, reverse=True)
   recent_tasks.sort(cmp_exec_time, reverse=True)
 
 
-  if request.REQUEST.get('format') == 'json':
+  if request.GET.get('format') == 'json':
     json_failed_tasks = [massage_task_for_json(task) for task in failed_tasks]
     json_failed_tasks = [massage_task_for_json(task) for task in failed_tasks]
     json_recent_tasks = [massage_task_for_json(task) for task in recent_tasks]
     json_recent_tasks = [massage_task_for_json(task) for task in recent_tasks]
     json_job = {
     json_job = {
@@ -291,9 +291,9 @@ def kill_job(request, job):
       LOG.warn('Failed to get job with ID %s: %s' % (job.jobId, e))
       LOG.warn('Failed to get job with ID %s: %s' % (job.jobId, e))
     else:
     else:
       if job.status not in ["RUNNING", "QUEUED"]:
       if job.status not in ["RUNNING", "QUEUED"]:
-        if request.REQUEST.get("next"):
-          return HttpResponseRedirect(request.REQUEST.get("next"))
-        elif request.REQUEST.get("format") == "json":
+        if request.GET.get("next"):
+          return HttpResponseRedirect(request.GET.get("next"))
+        elif request.GET.get("format") == "json":
           return JsonResponse({'status': 0}, encoder=JSONEncoderForHTML)
           return JsonResponse({'status': 0}, encoder=JSONEncoderForHTML)
         else:
         else:
           raise MessageException("Job Killed")
           raise MessageException("Job Killed")

+ 10 - 10
apps/metastore/src/metastore/views.py

@@ -200,7 +200,7 @@ def show_tables(request, database=None):
   if database is None:
   if database is None:
     database = 'default' # Assume always 'default'
     database = 'default' # Assume always 'default'
 
 
-  if request.REQUEST.get("format", "html") == "json":
+  if request.GET.get("format", "html") == "json":
     try:
     try:
       databases = db.get_databases()
       databases = db.get_databases()
 
 
@@ -238,7 +238,7 @@ def show_tables(request, database=None):
     'is_navigator_enabled': has_navigator(request.user),
     'is_navigator_enabled': has_navigator(request.user),
     'optimizer_url': get_optimizer_url(),
     'optimizer_url': get_optimizer_url(),
     'navigator_url': get_navigator_url(),
     'navigator_url': get_navigator_url(),
-    'is_embeddable': request.REQUEST.get('is_embeddable', False),
+    'is_embeddable': request.GET.get('is_embeddable', False),
     'source_type': _get_servername(db),
     'source_type': _get_servername(db),
     })
     })
 
 
@@ -275,7 +275,7 @@ def describe_table(request, database, table):
     LOG.exception("Describe table error")
     LOG.exception("Describe table error")
     raise PopupException(_("DB Error"), detail=e.message if hasattr(e, 'message') and e.message else e)
     raise PopupException(_("DB Error"), detail=e.message if hasattr(e, 'message') and e.message else e)
 
 
-  if request.REQUEST.get("format", "html") == "json":
+  if request.GET.get("format", "html") == "json":
     return JsonResponse({
     return JsonResponse({
         'status': 0,
         'status': 0,
         'name': table.name,
         'name': table.name,
@@ -316,7 +316,7 @@ def describe_table(request, database, table):
       'is_navigator_enabled': has_navigator(request.user),
       'is_navigator_enabled': has_navigator(request.user),
       'optimizer_url': get_optimizer_url(),
       'optimizer_url': get_optimizer_url(),
       'navigator_url': get_navigator_url(),
       'navigator_url': get_navigator_url(),
-      'is_embeddable': request.REQUEST.get('is_embeddable', False),
+      'is_embeddable': request.GET.get('is_embeddable', False),
       'source_type': _get_servername(db),
       'source_type': _get_servername(db),
     })
     })
 
 
@@ -515,13 +515,13 @@ def describe_partitions(request, database, table):
   if not table_obj.partition_keys:
   if not table_obj.partition_keys:
     raise PopupException(_("Table '%(table)s' is not partitioned.") % {'table': table})
     raise PopupException(_("Table '%(table)s' is not partitioned.") % {'table': table})
 
 
-  reverse_sort = request.REQUEST.get("sort", "desc").lower() == "desc"
+  reverse_sort = request.GET.get("sort", "desc").lower() == "desc"
 
 
   if request.method == "POST":
   if request.method == "POST":
     partition_filters = {}
     partition_filters = {}
     for part in table_obj.partition_keys:
     for part in table_obj.partition_keys:
-      if request.REQUEST.get(part.name):
-        partition_filters[part.name] = request.REQUEST.get(part.name)
+      if request.GET.get(part.name):
+        partition_filters[part.name] = request.GET.get(part.name)
     partition_spec = ','.join(["%s='%s'" % (k, v) for k, v in partition_filters.items()])
     partition_spec = ','.join(["%s='%s'" % (k, v) for k, v in partition_filters.items()])
   else:
   else:
     partition_spec = ''
     partition_spec = ''
@@ -562,7 +562,7 @@ def describe_partitions(request, database, table):
         'is_navigator_enabled': has_navigator(request.user),
         'is_navigator_enabled': has_navigator(request.user),
         'optimizer_url': get_optimizer_url(),
         'optimizer_url': get_optimizer_url(),
         'navigator_url': get_navigator_url(),
         'navigator_url': get_navigator_url(),
-        'is_embeddable': request.REQUEST.get('is_embeddable', False),
+        'is_embeddable': request.GET.get('is_embeddable', False),
         'source_type': _get_servername(db),
         'source_type': _get_servername(db),
     })
     })
 
 
@@ -595,7 +595,7 @@ def browse_partition(request, database, table, partition_spec):
     decoded_spec = urllib.unquote(partition_spec)
     decoded_spec = urllib.unquote(partition_spec)
     partition_table = db.describe_partition(database, table, decoded_spec)
     partition_table = db.describe_partition(database, table, decoded_spec)
     uri_path = location_to_url(partition_table.path_location)
     uri_path = location_to_url(partition_table.path_location)
-    if request.REQUEST.get("format", "html") == "json":
+    if request.GET.get("format", "html") == "json":
       return JsonResponse({'uri_path': uri_path})
       return JsonResponse({'uri_path': uri_path})
     else:
     else:
       return redirect(uri_path)
       return redirect(uri_path)
@@ -625,7 +625,7 @@ def drop_partition(request, database, table):
     partition_specs = request.POST.getlist('partition_selection')
     partition_specs = request.POST.getlist('partition_selection')
     partition_specs = [spec for spec in partition_specs]
     partition_specs = [spec for spec in partition_specs]
     try:
     try:
-      if request.REQUEST.get("format", "html") == "json":
+      if request.GET.get("format", "html") == "json":
         last_executed = json.loads(request.POST.get('start_time'), '-1')
         last_executed = json.loads(request.POST.get('start_time'), '-1')
         sql = db.drop_partitions(database, table, partition_specs, design=None, generate_ddl_only=True)
         sql = db.drop_partitions(database, table, partition_specs, design=None, generate_ddl_only=True)
         job = make_notebook(
         job = make_notebook(

+ 2 - 2
apps/oozie/src/oozie/decorators.py

@@ -37,8 +37,8 @@ def check_document_access_permission():
       doc_id = uuid = doc2 = None
       doc_id = uuid = doc2 = None
 
 
       try:
       try:
-        if request.REQUEST.get('workflow'):
-          workflow_id = request.REQUEST.get('workflow')
+        if request.GET.get('workflow'):
+          workflow_id = request.GET.get('workflow')
           if workflow_id.isdigit():
           if workflow_id.isdigit():
             doc_id = workflow_id
             doc_id = workflow_id
           else:
           else:

+ 1 - 1
apps/oozie/src/oozie/models.py

@@ -1396,7 +1396,7 @@ class Coordinator(Job):
                                help_text=_t('When to start the first workflow.'))
                                help_text=_t('When to start the first workflow.'))
   end = models.DateTimeField(default=dtz.now, verbose_name=_t('End'),
   end = models.DateTimeField(default=dtz.now, verbose_name=_t('End'),
                              help_text=_t('When to start the last workflow.'))
                              help_text=_t('When to start the last workflow.'))
-  workflow = models.ForeignKey(Workflow, null=True, verbose_name=_t('Workflow'),
+  coordinatorworkflow = models.ForeignKey(Workflow, null=True, verbose_name=_t('Workflow'),
                                help_text=_t('The workflow to schedule repeatedly.'))
                                help_text=_t('The workflow to schedule repeatedly.'))
   timeout = models.SmallIntegerField(null=True, blank=True, verbose_name=_t('Timeout'),
   timeout = models.SmallIntegerField(null=True, blank=True, verbose_name=_t('Timeout'),
                                      help_text=_t('Number of minutes the coordinator action will be in '
                                      help_text=_t('Number of minutes the coordinator action will be in '

+ 1 - 1
apps/oozie/src/oozie/views/dashboard.py

@@ -651,7 +651,7 @@ def list_oozie_sla(request):
   else:
   else:
     oozie_slas = [] # or get latest?
     oozie_slas = [] # or get latest?
 
 
-  if request.REQUEST.get('format') == 'json':
+  if request.GET.get('format') == 'json':
     massaged_slas = []
     massaged_slas = []
     for sla in oozie_slas:
     for sla in oozie_slas:
       massaged_slas.append(massaged_sla_for_json(sla))
       massaged_slas.append(massaged_sla_for_json(sla))

+ 29 - 6
desktop/core/ext-py/Django-1.9/django/template/context.py

@@ -214,6 +214,24 @@ class RenderContext(BaseContext):
     def __getitem__(self, key):
     def __getitem__(self, key):
         return self.dicts[-1][key]
         return self.dicts[-1][key]
 
 
+from django.utils.module_loading import import_string
+_standard_context_processors = None
+
+# This is a function rather than module-level procedural code because we only
+# want it to execute if somebody uses RequestContext.
+def get_standard_processors():
+    from django.conf import settings
+    global _standard_context_processors
+    if _standard_context_processors is None:
+        processors = []
+        collect = []
+        collect.extend(_builtin_context_processors)
+        collect.extend(settings.TEMPLATE_CONTEXT_PROCESSORS)
+        for path in collect:
+            func = import_string(path)
+            processors.append(func)
+        _standard_context_processors = tuple(processors)
+    return _standard_context_processors
 
 
 class RequestContext(Context):
 class RequestContext(Context):
     """
     """
@@ -239,12 +257,17 @@ class RequestContext(Context):
         self._processors = () if processors is None else tuple(processors)
         self._processors = () if processors is None else tuple(processors)
         self._processors_index = len(self.dicts)
         self._processors_index = len(self.dicts)
 
 
-        # placeholder for context processors output
-        self.update({})
-
-        # empty dict for any new modifications
-        # (so that context processors don't overwrite them)
-        self.update({})
+        updates = dict()
+        for processor in get_standard_processors():
+            updates.update(processor(request))
+        self.update(updates)
+
+        # # placeholder for context processors output
+        # self.update({})
+        #
+        # # empty dict for any new modifications
+        # # (so that context processors don't overwrite them)
+        # self.update({})
 
 
     @contextmanager
     @contextmanager
     def bind_template(self, template):
     def bind_template(self, template):

+ 1 - 1
desktop/core/src/desktop/auth/backend.py

@@ -36,7 +36,7 @@ import django.contrib.auth.backends
 from django.contrib.auth.models import User
 from django.contrib.auth.models import User
 from django.core.exceptions import ImproperlyConfigured, PermissionDenied
 from django.core.exceptions import ImproperlyConfigured, PermissionDenied
 from django.forms import ValidationError
 from django.forms import ValidationError
-from django.utils.importlib import import_module
+from importlib import import_module
 
 
 from django_auth_ldap.backend import LDAPBackend
 from django_auth_ldap.backend import LDAPBackend
 from django_auth_ldap.config import LDAPSearch
 from django_auth_ldap.config import LDAPSearch

+ 5 - 6
desktop/core/src/desktop/auth/views.py

@@ -48,7 +48,6 @@ from hadoop.fs.exceptions import WebHdfsException
 from useradmin.models import get_profile
 from useradmin.models import get_profile
 from useradmin.views import ensure_home_directory, require_change_password
 from useradmin.views import ensure_home_directory, require_change_password
 
 
-
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 
 
 
@@ -88,7 +87,7 @@ def dt_login_old(request, from_modal=False):
 @login_notrequired
 @login_notrequired
 @watch_login
 @watch_login
 def dt_login(request, from_modal=False):
 def dt_login(request, from_modal=False):
-  redirect_to = request.REQUEST.get('next', '/')
+  redirect_to = request.GET.get('next', '/')
   is_first_login_ever = first_login_ever()
   is_first_login_ever = first_login_ever()
   backend_names = auth_forms.get_backend_names()
   backend_names = auth_forms.get_backend_names()
   is_active_directory = auth_forms.is_active_directory()
   is_active_directory = auth_forms.is_active_directory()
@@ -142,8 +141,8 @@ def dt_login(request, from_modal=False):
 
 
         msg = 'Successful login for user: %s' % user.username
         msg = 'Successful login for user: %s' % user.username
         request.audit['operationText'] = msg
         request.audit['operationText'] = msg
-        access_log(request, msg)
-        if from_modal or request.REQUEST.get('fromModal', 'false') == 'true':
+        access_warn(request, msg)
+        if from_modal or request.GET.get('fromModal', 'false') == 'true':
           return JsonResponse({'auth': True})
           return JsonResponse({'auth': True})
         else:
         else:
           return HttpResponseRedirect(redirect_to)
           return HttpResponseRedirect(redirect_to)
@@ -152,7 +151,7 @@ def dt_login(request, from_modal=False):
         msg = 'Failed login for user: %s' % request.POST.get('username')
         msg = 'Failed login for user: %s' % request.POST.get('username')
         request.audit['operationText'] = msg
         request.audit['operationText'] = msg
         access_warn(request, msg)
         access_warn(request, msg)
-        if from_modal or request.REQUEST.get('fromModal', 'false') == 'true':
+        if from_modal or request.GET.get('fromModal', 'false') == 'true':
           return JsonResponse({'auth': False})
           return JsonResponse({'auth': False})
 
 
   else:
   else:
@@ -268,6 +267,6 @@ def oauth_authenticated(request):
   user = authenticate(access_token=access_token)
   user = authenticate(access_token=access_token)
   login(request, user)
   login(request, user)
 
 
-  redirect_to = request.REQUEST.get('next', '/')
+  redirect_to = request.GET.get('next', '/')
   return HttpResponseRedirect(redirect_to)
   return HttpResponseRedirect(redirect_to)
 
 

+ 1 - 1
desktop/core/src/desktop/lib/django_mako.py

@@ -107,7 +107,7 @@ def render_to_string_normal(template_name, django_context):
     for d in reversed(django_context.dicts):
     for d in reversed(django_context.dicts):
       if d:
       if d:
         data_dict.update(d)
         data_dict.update(d)
-    data_dict.update(django_context.request)
+    data_dict.update({'request': django_context.request})
   else:
   else:
     data_dict = django_context
     data_dict = django_context
 
 

+ 2 - 2
desktop/core/src/desktop/middleware.py

@@ -77,7 +77,7 @@ class AjaxMiddleware(object):
   GET parameters.
   GET parameters.
   """
   """
   def process_request(self, request):
   def process_request(self, request):
-    request.ajax = request.is_ajax() or request.REQUEST.get("format", "") == "json"
+    request.ajax = request.is_ajax() or request.GET.get("format", "") == "json"
     return None
     return None
 
 
 
 
@@ -120,7 +120,7 @@ class ClusterMiddleware(object):
     Sets request.fs and request.jt on every request to point to the
     Sets request.fs and request.jt on every request to point to the
     configured filesystem.
     configured filesystem.
     """
     """
-    request.fs_ref = request.REQUEST.get('fs', view_kwargs.get('fs', 'default'))
+    request.fs_ref = request.GET.get('fs', view_kwargs.get('fs', 'default'))
     if "fs" in view_kwargs:
     if "fs" in view_kwargs:
       del view_kwargs["fs"]
       del view_kwargs["fs"]
 
 

+ 9 - 8
desktop/core/src/desktop/settings.py

@@ -54,7 +54,7 @@ ENV_DESKTOP_DEBUG = "DESKTOP_DEBUG"
 
 
 # Configure debug mode
 # Configure debug mode
 DEBUG = True
 DEBUG = True
-TEMPLATE_DEBUG = DEBUG
+GTEMPLATE_DEBUG = DEBUG
 
 
 # Start basic logging as soon as possible.
 # Start basic logging as soon as possible.
 if ENV_HUE_PROCESS_NAME not in os.environ:
 if ENV_HUE_PROCESS_NAME not in os.environ:
@@ -132,7 +132,7 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'build', 'static')
 
 
 
 
 # List of callables that know how to import templates from various sources.
 # List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
+GTEMPLATE_LOADERS = (
   'django.template.loaders.filesystem.Loader',
   'django.template.loaders.filesystem.Loader',
   'django.template.loaders.app_directories.Loader'
   'django.template.loaders.app_directories.Loader'
 )
 )
@@ -175,7 +175,7 @@ ROOT_URLCONF = 'desktop.urls'
 # Hue runs its own wsgi applications
 # Hue runs its own wsgi applications
 WSGI_APPLICATION = None
 WSGI_APPLICATION = None
 
 
-TEMPLATE_DIRS = (
+GTEMPLATE_DIRS = (
     get_desktop_root("core/templates"),
     get_desktop_root("core/templates"),
 )
 )
 
 
@@ -208,7 +208,7 @@ LOCALE_PATHS = [
 ]
 ]
 
 
 # Keep default values up to date
 # Keep default values up to date
-TEMPLATE_CONTEXT_PROCESSORS = (
+GTEMPLATE_CONTEXT_PROCESSORS = (
   'django.contrib.auth.context_processors.auth',
   'django.contrib.auth.context_processors.auth',
   'django.template.context_processors.debug',
   'django.template.context_processors.debug',
   'django.template.context_processors.i18n',
   'django.template.context_processors.i18n',
@@ -222,10 +222,11 @@ TEMPLATE_CONTEXT_PROCESSORS = (
 TEMPLATES = [
 TEMPLATES = [
   {
   {
     'BACKEND': 'djangomako.backends.MakoBackend',
     'BACKEND': 'djangomako.backends.MakoBackend',
-    'DIRS': TEMPLATE_DIRS,
+    'DIRS': GTEMPLATE_DIRS,
     'NAME': 'mako',
     'NAME': 'mako',
     'OPTIONS': {
     'OPTIONS': {
-      'context_processors': TEMPLATE_CONTEXT_PROCESSORS,
+      'context_processors': GTEMPLATE_CONTEXT_PROCESSORS,
+      'loaders': GTEMPLATE_LOADERS,
     },
     },
   },
   },
 ]
 ]
@@ -282,7 +283,7 @@ conf.initialize(_app_conf_modules, _config_dir)
 
 
 # Now that we've loaded the desktop conf, set the django DEBUG mode based on the conf.
 # Now that we've loaded the desktop conf, set the django DEBUG mode based on the conf.
 DEBUG = desktop.conf.DJANGO_DEBUG_MODE.get()
 DEBUG = desktop.conf.DJANGO_DEBUG_MODE.get()
-TEMPLATE_DEBUG = DEBUG
+GTEMPLATE_DEBUG = DEBUG
 if DEBUG: # For simplification, force all DEBUG when django_debug_mode is True and re-apply the loggers
 if DEBUG: # For simplification, force all DEBUG when django_debug_mode is True and re-apply the loggers
   os.environ[ENV_DESKTOP_DEBUG] = 'True'
   os.environ[ENV_DESKTOP_DEBUG] = 'True'
   desktop.log.basic_logging(os.environ[ENV_HUE_PROCESS_NAME])
   desktop.log.basic_logging(os.environ[ENV_HUE_PROCESS_NAME])
@@ -526,7 +527,7 @@ if desktop.conf.INSTRUMENTATION.get():
 if not desktop.conf.DATABASE_LOGGING.get():
 if not desktop.conf.DATABASE_LOGGING.get():
   def disable_database_logging():
   def disable_database_logging():
     from django.db.backends.base.base import BaseDatabaseWrapper
     from django.db.backends.base.base import BaseDatabaseWrapper
-    from django.db.backends.util import CursorWrapper
+    from django.db.backends.utils import CursorWrapper
 
 
     BaseDatabaseWrapper.make_debug_cursor = lambda self, cursor: CursorWrapper(cursor, self)
     BaseDatabaseWrapper.make_debug_cursor = lambda self, cursor: CursorWrapper(cursor, self)
 
 

+ 2 - 2
desktop/core/src/desktop/views.py

@@ -32,7 +32,7 @@ from django.conf import settings
 from django.shortcuts import render_to_response
 from django.shortcuts import render_to_response
 from django.http import HttpResponse
 from django.http import HttpResponse
 from django.core.urlresolvers import reverse
 from django.core.urlresolvers import reverse
-from django.core.servers.basehttp import FileWrapper
+from wsgiref.util import FileWrapper
 from django.shortcuts import redirect
 from django.shortcuts import redirect
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.views.decorators.http import require_POST
 from django.views.decorators.http import require_POST
@@ -463,7 +463,7 @@ def log_frontend_event(request):
   "error", or "critical"), and "message".
   "error", or "critical"), and "message".
   """
   """
   def get(param, default=None):
   def get(param, default=None):
-    return request.REQUEST.get(param, default)
+    return request.GET.get(param, default)
 
 
   level = _LOG_LEVELS.get(get("level"), logging.INFO)
   level = _LOG_LEVELS.get(get("level"), logging.INFO)
   msg = "Untrusted log event from user %s: %s" % (
   msg = "Untrusted log event from user %s: %s" % (

+ 1 - 1
desktop/libs/hadoop/src/hadoop/fs/upload.py

@@ -152,7 +152,7 @@ class HDFSfileUploadHandler(FileUploadHandler):
     if field_name.upper().startswith('HDFS'):
     if field_name.upper().startswith('HDFS'):
       LOG.info('Using HDFSfileUploadHandler to handle file upload.')
       LOG.info('Using HDFSfileUploadHandler to handle file upload.')
       try:
       try:
-        fs_ref = self.request.REQUEST.get('fs', 'default')
+        fs_ref = self.request.GET.get('fs', 'default')
         self.request.fs = fsmanager.get_filesystem(fs_ref)
         self.request.fs = fsmanager.get_filesystem(fs_ref)
         self.request.fs.setuser(self.request.user.username)
         self.request.fs.setuser(self.request.user.username)
         self._file = HDFStemporaryUploadedFile(self.request, file_name, self._destination)
         self._file = HDFStemporaryUploadedFile(self.request, file_name, self._destination)

+ 1 - 1
desktop/libs/indexer/src/indexer/solr_api.py

@@ -65,7 +65,7 @@ def list_indexes(request):
 def list_index(request):
 def list_index(request):
   response = {'status': -1}
   response = {'status': -1}
 
 
-  name = request.REQUEST.get('name')
+  name = request.GET.get('name')
 
 
   client = SolrClient(user=request.user)
   client = SolrClient(user=request.user)
 
 

+ 2 - 2
desktop/libs/liboauth/src/liboauth/backend.py

@@ -198,7 +198,7 @@ class OAuthBackend(DesktopBackendBase):
     response_type = "code"
     response_type = "code"
  
  
     social = request.GET['social']
     social = request.GET['social']
-    state = social + "," + request.REQUEST.get('next', '/')
+    state = social + "," + request.GET.get('next', '/')
 
 
     if social == 'google':
     if social == 'google':
       consumer_key=liboauth.conf.CONSUMER_KEY_GOOGLE.get()
       consumer_key=liboauth.conf.CONSUMER_KEY_GOOGLE.get()
@@ -294,4 +294,4 @@ def get_redirect_uri(request):
   host = request.get_host()
   host = request.get_host()
   path = '/oauth/social_login/oauth_authenticated'
   path = '/oauth/social_login/oauth_authenticated'
 
 
-  return protocol + "://" + host + path
+  return protocol + "://" + host + path

+ 1 - 1
desktop/libs/liboauth/src/liboauth/views.py

@@ -48,7 +48,7 @@ from liboauth.backend import OAuthBackend
 @login_notrequired
 @login_notrequired
 def show_login_page(request, login_errors=False):
 def show_login_page(request, login_errors=False):
    """Used by the non-jframe login"""
    """Used by the non-jframe login"""
-   redirect_to = request.REQUEST.get('next', '/')
+   redirect_to = request.GET.get('next', '/')
    is_first_login_ever = OAuthBackend.is_first_login_ever()
    is_first_login_ever = OAuthBackend.is_first_login_ever()
 
 
    request.session.set_test_cookie()
    request.session.set_test_cookie()

+ 1 - 1
desktop/libs/libopenid/src/libopenid/views.py

@@ -34,7 +34,7 @@ __all__ = ['login_begin', 'login_complete']
 
 
 
 
 def login_begin(request):
 def login_begin(request):
-  redirect_to = request.REQUEST.get('next', '/')
+  redirect_to = request.GET.get('next', '/')
   is_first_login_ever = OpenIDBackend.is_first_login_ever()
   is_first_login_ever = OpenIDBackend.is_first_login_ever()
 
 
   request.session.set_test_cookie()
   request.session.set_test_cookie()

+ 2 - 2
desktop/libs/metadata/src/metadata/navigator_api.py

@@ -384,7 +384,7 @@ def get_entity(request):
   response = {'status': -1}
   response = {'status': -1}
 
 
   api = NavigatorApi(request.user)
   api = NavigatorApi(request.user)
-  entity_id = request.REQUEST.get('id')
+  entity_id = request.GET.get('id')
 
 
   if not entity_id:
   if not entity_id:
     raise MetadataApiException("get_entity requires an 'id' parameter")
     raise MetadataApiException("get_entity requires an 'id' parameter")
@@ -507,7 +507,7 @@ def get_lineage(request):
   response = {'status': -1, 'inputs': [], 'source_query': '', 'target_queries': [], 'targets': []}
   response = {'status': -1, 'inputs': [], 'source_query': '', 'target_queries': [], 'targets': []}
 
 
   api = NavigatorApi(request.user)
   api = NavigatorApi(request.user)
-  entity_id = request.REQUEST.get('id')
+  entity_id = request.GET.get('id')
 
 
   if not entity_id:
   if not entity_id:
     raise MetadataApiException("get_lineage requires an 'id' parameter")
     raise MetadataApiException("get_lineage requires an 'id' parameter")