#12049: New LazyObject-wrapped User breaks queries in template tags
-------------------------------------+--------------------------------------
          Reporter:  chipx86         |         Owner:  nobody
            Status:  new             |     Milestone:        
         Component:  Authentication  |       Version:  SVN   
        Resolution:                  |      Keywords:        
             Stage:  Unreviewed      |     Has_patch:  1     
        Needs_docs:  0               |   Needs_tests:  0     
Needs_better_patch:  0               |  
-------------------------------------+--------------------------------------
Comment (by lukeplant):

 Thanks for the test, that's really useful.  Hopefully I look at fixing
 this on Monday.  If you want to do it yourself, I imagine the fix will be
 to implement `__deepcopy__` on !SimpleLazyObject.  I think the
 implementation is straightforward - if `self._wrapped is None`, then you
 just assign the same _setupfunc function to the copy (no need to make a
 copy of the function).  If `self._wrapped is not None`, you copy the
 wrapped object itself.

 In this context, I don't think we need a deep copy of the wrapped object,
 because it is just going to be thrown away and not modified, but to obey
 the `__deepcopy__` contract, you might want to make it a deep copy.
 Alternatively, you could make a !ContextLazyObject which subclasses
 !SimpleLazyObject, and has a `__deepcopy__` method that does shallow
 copies, which should be safe if !ContextLazyObject is only used for this
 purpose.  Perhaps.  I haven't thought about it properly.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12049#comment:2>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to