[kforge-dev] changes to domain object attributes: does this result in an update event

Rufus Pollock rufus.pollock at okfn.org
Tue Dec 20 12:21:54 UTC 2005


John Bywater wrote:
> Rufus -
> 
> Currently, that code would not result in a persistent change, because 
> the save() method hasn't been called.
> 
> Calling save() on a DomainObject maps all attributes to the database 
> record, and then calls the raiseUpdate() method.

Great -- that's what I needed to know. All i was missing from the below 
was a memberAnna.save()

> I fairly sure the system performance would be compromised if a call to 
> the database is made each time an attribute is changed.

Good point and I think you are right we should stick with an explicit 
save rather than auto-saving on each write to an attribute.

Regards,

Rufus

> Rufus Pollock wrote:
> 
>> Imagine i do the following:
>>
>> reg = kforge.dom.DomainRegistry()
>> person = reg.persons['anna']
>> project = reg.projects['annakarenina']
>> memberAnna = project.members[person]
>> newRole = reg.roles['Friend']
>> # current role is developer
>> memberAnna.role = newRole
>>
>> My question is: does this result in an onMemberUpdate event?
>>
>> I suggest that it should and that in fact all **setting** of 
>> attributes on domain objects should result in the raising of an update 
>> event for that domain object (for those domain objects that have an 
>> update event).
>>
>> Regards,
>>
>> Rufus
>>
>> _______________________________________________
>> kforge-dev mailing list
>> kforge-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/kforge-dev
>>
>>
>>
> 




More information about the kforge-dev mailing list