Hi all,

There is a bit of cruft in LazyObject that I'd like to fix - 
'get_all_members'.  This seems to be left over from before it got 
separated from LazySettings.  The method is *only* needed to support 
introspection, which is usually only used from the interactive prompt.

There is a much better way of doing it - implement the __members__ 
property and the __dir__() method.  This is the standard and future 
compatible way.

I'll need to fix the few instances of where LazyObject is subclassed 
in Django itself.

If anyone else has subclassed LazyObject, from now on the 
'get_all_members' method of wrapped objects will be ignored.  In most 
cases, this will have no effect, because the default __dir__() will do 
the right thing.  

In exceptional cases (where the wrapped object implements 
__getattr__()), introspection won't return all the attributes that it 
should.

Upgrading is easy - if your wrapped object does not implement 
__getattr__(), just remove 'get_all_members()'.  If it does, replace 
'get_all_members' with '__dir__', and if using Python < 2.6, add:

    __members__ = property(lambda self: self.__dir__())

Any objections to this? I can only imagine that it will affect 
interactive usage at the Python prompt in a few obscure cases, if 
anything. But I could have missed something.

Luke

-- 
You meet a lot of smart guys with stupid wives, but you almost 
never meet a smart woman with a stupid husband. (Erica Jong)

Luke Plant || http://lukeplant.me.uk/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to