#29852: Infinite migrations when using SimpleLazyObject in field arguments
------------------------------+------------------------------------
     Reporter:  Javier Buzzi  |                    Owner:  nobody
         Type:  Bug           |                   Status:  new
    Component:  Migrations    |                  Version:  master
     Severity:  Normal        |               Resolution:
     Keywords:                |             Triage Stage:  Accepted
    Has patch:  1             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  1
Easy pickings:  0             |                    UI/UX:  0
------------------------------+------------------------------------

Comment (by Javier Buzzi):

 So something around the lines of?


 {{{
 diff --git a/django/core/validators.py b/django/core/validators.py
 index c1c9cd1c87..c2fb66e241 100644
 --- a/django/core/validators.py
 +++ b/django/core/validators.py
 @@ -317,8 +317,11 @@ class BaseValidator:

      def __call__(self, value):
          cleaned = self.clean(value)
 -        params = {'limit_value': self.limit_value, 'show_value': cleaned,
 'value': value}
 -        if self.compare(cleaned, self.limit_value):
 +        limit_value = self.limit_value
 +        if callable(limit_value):
 +            limit_value = self.limit_value()
 +        params = {'limit_value': limit_value, 'show_value': cleaned,
 'value': value}
 +        if self.compare(cleaned, limit_value):
              raise ValidationError(self.message, code=self.code,
 params=params)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29852#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.77f60fe7e5df872e1c164acdd05edfff%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to