Added some new patches, including a patch to patch.py to let us report when patching has happened.
- Legacy-Id: 14663
This commit is contained in:
parent
06362ec046
commit
a7085715f5
|
@ -366,13 +366,23 @@ def maybe_patch_library(app_configs, **kwargs):
|
||||||
for patch_file in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY:
|
for patch_file in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY:
|
||||||
patch_path = os.path.join(saved_cwd, patch_file)
|
patch_path = os.path.join(saved_cwd, patch_file)
|
||||||
patch_set = patch.fromfile(patch_path)
|
patch_set = patch.fromfile(patch_path)
|
||||||
|
if not hasattr(patch_set, 'already_patched'):
|
||||||
|
patch_set.already_patched = False
|
||||||
if patch_set:
|
if patch_set:
|
||||||
if not patch_set.apply():
|
applied = patch_set.apply()
|
||||||
|
if not applied:
|
||||||
errors.append(checks.Warning(
|
errors.append(checks.Warning(
|
||||||
"Could not apply patch from file '%s'"%patch_file,
|
"Could not apply patch from file '%s'"%patch_file,
|
||||||
hint="Make sure that the patch file contains a unified diff and has valid file paths",
|
hint="Make sure that the patch file contains a unified diff and has valid file paths",
|
||||||
id="datatracker.W0002",
|
id="datatracker.W0002",
|
||||||
))
|
))
|
||||||
|
elif patch_set.already_patched:
|
||||||
|
#for p in patch_set:
|
||||||
|
# sys.stderr.write(" Already patched: %s\n" % p.target)
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
for p in patch_set:
|
||||||
|
sys.stderr.write(" Patched %s\n" % p.target)
|
||||||
else:
|
else:
|
||||||
errors.append(checks.Warning(
|
errors.append(checks.Warning(
|
||||||
"Could not parse patch file '%s'"%patch_file,
|
"Could not parse patch file '%s'"%patch_file,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- django/db/models/fields/__init__.py.old 2017-06-14 08:43:21.665812000 -0700
|
--- django/db/models/fields/__init__.py.old 2017-06-14 08:43:21.665812000 -0700
|
||||||
+++ django/db/models/fields/__init__.py 2017-12-17 14:34:03.023976702 -0800
|
+++ django/db/models/fields/__init__.py 2017-12-17 14:34:03.023976702 -0800
|
||||||
@@ -2344,7 +2344,7 @@
|
@@ -2340,7 +2340,7 @@
|
||||||
if self.has_default() and not callable(self.default):
|
if self.has_default() and not callable(self.default):
|
||||||
return self.default
|
return self.default
|
||||||
default = super(BinaryField, self).get_default()
|
default = super(BinaryField, self).get_default()
|
||||||
|
@ -8,4 +8,23 @@
|
||||||
+ if isinstance(default, six.text_type) and default == '':
|
+ if isinstance(default, six.text_type) and default == '':
|
||||||
return b''
|
return b''
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
--- django/forms/widgets.py.old 2018-02-21 15:17:40.742742712 -0800
|
||||||
|
+++ django/forms/widgets.py 2018-02-21 15:19:57.182002508 -0800
|
||||||
|
@@ -7,6 +7,7 @@
|
||||||
|
import copy
|
||||||
|
import datetime
|
||||||
|
import re
|
||||||
|
+import six
|
||||||
|
from itertools import chain
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
@@ -195,7 +196,7 @@
|
||||||
|
"""
|
||||||
|
Return a value as it should appear when rendered in a template.
|
||||||
|
"""
|
||||||
|
- if value == '' or value is None:
|
||||||
|
+ if value is None or isinstance(value, six.string_types) and len(value) == 0:
|
||||||
|
return None
|
||||||
|
if self.is_localized:
|
||||||
|
return formats.localize_input(value)
|
||||||
|
|
Loading…
Reference in a new issue