#23346: django.utils.functional.lazy picks the wrong method implementation
-------------------------------+--------------------
Reporter: gavinwahl | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
When a subclass of resultclasses is returned by the wrapped function,
method implementaions are looked up on the base class (the one in
resultclasses), not on the object actually returned.
{{{
#!python
def test_lazy_base_class_override(self):
"""Test that lazy finds the correct (overridden) method
implementation"""
class Base(object):
def method(self):
return 'Base'
class Klazz(Base):
def method(self):
return 'Klazz'
t = lazy(lambda: Klazz(), Base)()
self.assertEqual(t.method(), 'Klazz')
}}}
In the current implementation, `Base.method` will be called, not
`Klazz.method`.
--
Ticket URL: <https://code.djangoproject.com/ticket/23346>
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/052.fa2b51bc93e09a457dc9542fede77268%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.