[PEAK] What's the right way to remove entries from an EntityDM

Erik Rose psucorp at grinchcentral.com
Fri May 20 15:40:43 EDT 2005


On Mar 21, 2005, at 11:28 AM, Phillip J. Eby wrote:
>> From what i've seen in it's interface there's no mention on this
>> subject, nor there is any in QueryDM. I've overritten __delitem__ so
>> that it works as current __getitem__ does, by the oid.
>
> It's entirely up to you.  I personally favor 'dm.remove(ob)', as to me 
> it's like removing an item from a list or set.  peak.schema will use 
> this approach when it arrives, as it will treat a database as just a 
> giant set of objects.  So 'db.add(ob)' and 'db.remove(ob)' will be 
> used to add and remove objects.

Are you changing your mind, then, about the name of newItem() in 
EntityDM? I used delItem() in the code I'm working on for consistency 
with newItem(), but if you want to stick an add=newItem in EntityDM to 
canonicalize it, I'm all for it, as that would, as you intimated, be 
more Pythonic.

Erik




More information about the PEAK mailing list