From 812aa6381e7c44ed11e5ebc1c6147fa862e989b2 Mon Sep 17 00:00:00 2001 From: John Eskew Date: Tue, 8 Mar 2016 09:39:42 -0500 Subject: [PATCH] Upgrade to Django 1.8.11. Remove monkey patch required for v1.8.10. --- cms/startup.py | 4 +-- .../django_utils_http_is_safe_url.py | 30 ------------------- lms/startup.py | 4 +-- requirements/edx/base.txt | 2 +- 4 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 common/djangoapps/monkey_patch/django_utils_http_is_safe_url.py diff --git a/cms/startup.py b/cms/startup.py index 398fdbdc41..6f64dac161 100644 --- a/cms/startup.py +++ b/cms/startup.py @@ -11,8 +11,7 @@ from openedx.core.lib.django_startup import autostartup import django from monkey_patch import ( third_party_auth, - django_db_models_options, - django_utils_http_is_safe_url + django_db_models_options ) import xmodule.x_module @@ -27,7 +26,6 @@ def run(): """ third_party_auth.patch() django_db_models_options.patch() - django_utils_http_is_safe_url.patch() # Comprehensive theming needs to be set up before django startup, # because modifying django template paths after startup has no effect. diff --git a/common/djangoapps/monkey_patch/django_utils_http_is_safe_url.py b/common/djangoapps/monkey_patch/django_utils_http_is_safe_url.py deleted file mode 100644 index 35c2eb3c86..0000000000 --- a/common/djangoapps/monkey_patch/django_utils_http_is_safe_url.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Monkey patch the is_safe_url method in django.utils.http for Django 1.8.10. -In that release, the method crashes when a bytestring, non-unicode string is passed-in -as the url. -Remove the monkey patch when the bug is fixed in a Django 1.8 release. Here's the bug: -https://code.djangoproject.com/ticket/26308 -""" - -from django.utils import http -from django.utils.encoding import force_text - - -def patch(): - """ - Monkey patch the django.utils.http.is_safe_url function to convert the incoming - url and host parameters to unicode. - """ - def create_is_safe_url_wrapper(wrapped_func): - # pylint: disable=missing-docstring - def _wrap_is_safe_url(*args, **kwargs): - def _conv_text(value): - return None if value is None else force_text(value) - return wrapped_func( - # Converted *args. - *tuple(map(_conv_text, args)), - # Converted **kwargs. - **{key: _conv_text(value) for key, value in kwargs.items()} - ) - return _wrap_is_safe_url - http.is_safe_url = create_is_safe_url_wrapper(http.is_safe_url) diff --git a/lms/startup.py b/lms/startup.py index cb2aa018e7..b6e63c3232 100644 --- a/lms/startup.py +++ b/lms/startup.py @@ -14,8 +14,7 @@ import logging import analytics from monkey_patch import ( third_party_auth, - django_db_models_options, - django_utils_http_is_safe_url + django_db_models_options ) import xmodule.x_module @@ -33,7 +32,6 @@ def run(): """ third_party_auth.patch() django_db_models_options.patch() - django_utils_http_is_safe_url.patch() # To override the settings before executing the autostartup() for python-social-auth if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False): diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index f49e867d40..a60cb73b62 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -32,7 +32,7 @@ django-method-override==0.1.0 # We need a fix to DRF 3.2.x, for now use it from our own cherry-picked repo #djangorestframework>=3.1,<3.2 git+https://github.com/edx/django-rest-framework.git@3c72cb5ee5baebc4328947371195eae2077197b0#egg=djangorestframework==3.2.3 -django==1.8.10 +django==1.8.11 djangorestframework-jwt==1.7.2 djangorestframework-oauth==1.1.0 edx-django-oauth2-provider==0.5.0