Changeset 367

Show
Ignore:
Timestamp:
07/15/08 17:29:04 (6 years ago)
Author:
cleverdevil
Message:

The constructor for Entity no longer called from_dict as it can lead to unexpected results that may confuse users, and broke some projects that depended on the old functionality. In addition, the set method also no longer calls from_dict either, for the same reasons.

Now, to_dict and from_dict are fairly isolated and are only used when explicitly requested.

Note: Entity.__init__ does not just pass through to Entity.set because the additional copy of the keyword arguments triggered by the **kwargs in the call caused problems in my testing.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/elixir/entity.py

    r363 r367  
    873873 
    874874    def __init__(self, **kwargs): 
    875         self.from_dict(kwargs) 
    876  
     875        for key, value in kwargs.iteritems(): setattr(self, key, value) 
     876         
    877877    def set(self, **kwargs): 
    878         self.from_dict(kwargs) 
     878        for key, value in kwargs.iteritems(): setattr(self, key, value) 
    879879 
    880880    def update_or_create(cls, data, surrogate=True):