#779: turbogears.util.DictObj improvement
----------------------------------+-----------------------------------------
 Reporter:  [EMAIL PROTECTED]  |       Owner:  anonymous
     Type:  enhancement           |      Status:  new      
 Priority:  normal                |   Milestone:  0.9a5    
Component:  TurboGears            |     Version:  0.9a4    
 Severity:  normal                |    Keywords:           
----------------------------------+-----------------------------------------
 I was just poking around util.py, and noticed DictObj. This class seems
 only partially implemented (0.9a4), its purpose appears to be to "Make a
 dict look like an object." For this to be fully accurate it should also
 implement {{{__setattr__}}} and {{{__delattr__}}}, as of 0.9a4 it only
 implements {{{__getattr__}}}. Also, the current implementation defined its
 own, very minimal, method, this is unnecessary as {{{__getitem__}}} etc.
 have the same signature as {{{__getattr__}}}. My proposed implementation
 is as follows:

 {{{
 class DictObj(dict):
     """Make a dict look like an object."""

     __getattr__ = dict.__getitem__
     __setattr__ = dict.__setitem__
     __delattr__ = dict.__delitem__
 }}}
 This is all that's necessary to make a dict look, feel, and act like a
 classic object.

-- 
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/779>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Tickets" 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/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---

Reply via email to