#31877: TemplateView.get_context_data()'s kwargs returns SimpleLazyObjects that
causes a crash when filtering.
-------------------------------------+-------------------------------------
     Reporter:  Tim L. White         |                    Owner:  Adam
                                     |  (Chainz) Johnson
         Type:  Bug                  |                   Status:  new
    Component:  Generic views        |                  Version:  3.1
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Adam (Chainz) Johnson):

 😟 Hmm this is a tough one.

 psycopg2 uses `type(obj)` to look for its "adapter" - in its C extension:
 
https://github.com/psycopg/psycopg2/blob/e14e3385b4809ec4223894f8c7a009b1560eb41d/psycopg/microprotocols.c#L151
 . So this "proxy" approach may not be feasible.

 I know of a more accurate proxy wrapper that proxies more attributes than
 Django's lazy objects - wrapt.ObjectProxy -
 https://wrapt.readthedocs.io/en/latest/wrappers.html#object-proxy. But
 docs there acknowledge that it can't even make `type()` work, whilst it
 makes `isinstance()` work.

 Any ideas of alternative approaches?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31877#comment:10>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.65405446d334b821723b7c8ce2299945%40djangoproject.com.

Reply via email to