diff --git a/ietf/checks.py b/ietf/checks.py index 118375317..2aa5fcb41 100644 --- a/ietf/checks.py +++ b/ietf/checks.py @@ -351,20 +351,22 @@ def check_svn_import(app_configs, **kwargs): return errors @checks.register('files') -def maybe_patch_django(app_configs, **kwargs): +def maybe_patch_library(app_configs, **kwargs): errors = [] # Change path to our copy of django (this assumes we're running in a # virtualenv, which we should) import os, django django_path = os.path.dirname(django.__file__) - parent_path = os.path.dirname(django_path) + library_path = os.path.dirname(django_path) saved_cwd = os.getcwd() - os.chdir(parent_path) - # All patches in settings.CHECKS_DJANGO_PATCHES_TO_APPLY must have a + os.chdir(library_path) + # All patches in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY must have a # relative file path rooted in the django dir, for instance # 'django/db/models/fields/__init__.py' - for patch_file in settings.CHECKS_DJANGO_PATCHES_TO_APPLY: + for patch_file in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY: patch_path = os.path.join(saved_cwd, patch_file) + with open(patch_path) as f: + p = f.read() patch_set = patch.fromfile(patch_path) if patch_set: if not patch_set.apply(): diff --git a/ietf/settings.py b/ietf/settings.py index 94eec0411..28e8482ee 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -927,8 +927,9 @@ SILENCED_SYSTEM_CHECKS = [ "fields.W342", # Setting unique=True on a ForeignKey has the same effect as using a OneToOneField. ] -CHECKS_DJANGO_PATCHES_TO_APPLY = [ +CHECKS_LIBRARY_PATCHES_TO_APPLY = [ 'patch/fix-django-unicode-comparison-bug.patch', + 'patch/fix-unidecode-argument-warning.patch', ] STATS_NAMES_LIMIT = 25 diff --git a/patch/fix-unidecode-argument-warning.patch b/patch/fix-unidecode-argument-warning.patch new file mode 100644 index 000000000..588fb2987 --- /dev/null +++ b/patch/fix-unidecode-argument-warning.patch @@ -0,0 +1,14 @@ +--- unidecode/__init__.py.old 2018-01-17 07:54:06.882306379 -0800 ++++ unidecode/__init__.py 2018-01-09 04:26:04.210366000 -0800 +@@ -22,9 +22,9 @@ + + def _warn_if_not_unicode(string): + if version_info[0] < 3 and not isinstance(string, unicode): +- warnings.warn( "Argument %r is not an unicode object. " ++ warnings.warn( "Argument %r (%s) is not an unicode object. " + "Passing an encoded string will likely have " +- "unexpected results." % (type(string),), ++ "unexpected results." % (type(string), string[:16]), + RuntimeWarning, 2) + +