#19777: Casting a SimpleLazyObject to an int fails
------------------------------+-----------------------------------------
Reporter: mattrobenolt | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Keywords: functional simplelazyobject
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+-----------------------------------------
Should be pretty self explanatory. We noticed the bug when passing
`request.user` into a filter like:
{{{
Model.objects.filter(user=request.user)
}}}
Since Django is attempting to coerce the object to an int, it fails on the
SimpleLazyObject yielding:
{{{
TypeError: int() argument must be a string or a number, not
'SimpleLazyObject'
}}}
The error can be reproduced simple by doing:
{{{
class Foo(object):
__int__ = lambda self: 1
int(SimpleLazyObject(Foo)))
}}}
See https://github.com/django/django/pull/706 for a patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/19777>
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].
For more options, visit https://groups.google.com/groups/opt_out.