Changes between Initial Version and Version 1 of Ticket #25280, comment 4
- Timestamp:
- Aug 20, 2015, 2:33:13 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #25280, comment 4
initial v1 1 1 Before the commit that introduced the regression. `deep_deconstruct()` returns: 2 `[<django.core.validators.RegexValidator object at 0x7fb6ca4cd780>]` 2 `[<django.core.validators.RegexValidator object at 0x7fb6ca4cd780>]` for `validators`. 3 3 4 Now it returns this for historical models:5 `[('django.core.validators.RegexValidator', [re.compile('^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\Z'), 'Enter a valid IPv4 address.', 'invalid']` 4 Now it returns something like: 5 `[('django.core.validators.RegexValidator', [re.compile('^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\Z'), 'Enter a valid IPv4 address.', 'invalid']`. 6 6 7 ... or this when processing the actual models: 8 `('django.core.validators.RegexValidator', [re.compile('^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\Z'), <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f3a97c44b00>, 'invalid']` 9 10 The lazy error message is not resolved, so it's treated as unequal to the string in the historical model. 7 It looks like the `re.compile` objects on the old and new fields are not treated as equal. I believe that's why we use [https://github.com/django/django/blob/01966bb2a779f68d1a371acb1bf814fac7bb5132/django/core/validators.py#L55-L56 some different comparisons] in `RegexValidator.__eq__()`.