1) I'm hoping Chuck will look into this because he's been enhancing
MiddleKit's delete code recently.

2) If Chuck can't look into it and pronounce the patch 100% safe before
Friday, I'll go ahead and cut the 0.7 final release without this patch.  I
don't want to hold up 0.7 final any longer.

3) Could you upload the patch to SourceForge?  It makes it much easier for
us to track the patches and not forget about them if we can't get to them
right away.

- Geoff

> -----Original Message-----
> From: Jason Hildebrand [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 27, 2002 12:11 PM
> To: webware-discuss
> Subject: [Webware-discuss] [Fwd: problem deleting MiddleKit objects]
> 
> 
> The attached patch fixes this problem.  
> 
> Implementation: If an object such as "Item" is deleted, it checks all
> objects which it references (like Container), and gets each of these
> objects to remove it from any list attributes they might have.
> 
> It would be great if someone (Geoff?) could apply this to CVS.
> 
> peace,
> Jason
> 
> -----Forwarded Message-----
> 
> From: Jason Hildebrand <[EMAIL PROTECTED]>
> To: webware-discuss <[EMAIL PROTECTED]>
> Subject: problem deleting MiddleKit objects
> Date: 20 Mar 2002 15:39:17 -0600
> 
> I'm having a problem deleting a MK object which is a member of a list.
> 
> Assume the following model:
> 
> Class Attribute       Type
> -------------------------------------
> Item
>       container       Container
>       name            string
>       
> Container
>       name            string
>       items           list of Item
> 
> Now suppose there are two instances of Item (Item.1 and Item.2), one
> instance of container (Container.1) and both Items are contained in
> Container.1.  That is, Item.1.container() == Item.2.container() ==
> Container.1 (please excuse the abuse of notation).
> 
> Now I do something like:
>       
>       c = store.fetchObject( 'Container', 1 )
>       items = c.items()
>       print len(items)      # should be two
>       
>       # delete one of the items
>       store.deleteObject( items[0] )
>       store.saveChanges()
> 
>       print len( c.items() )  # should be one, but is still two
>       
> The reason is that the Container object caches its list of Items
> internally as self._items, but after the Item is deleted, it doesn't
> know to refresh its list.  So, short of calling store.clear() to toss
> out all cached objects (or restarting the app server), I 
> can't convince
> Container.1 that it now contains only one Item.  If I try to reference
> the "ghost" Item, I get a dangling reference error (which is correct).
> 
> Is this simply a matter of MiddleKit not being complete?  Or is this
> problem somehow unique to me? 
> 
> After spending a considerable amount of time going through the MK
> source, I suspect the former.  If this is the case, I'll take 
> a crack at
> implementing the correct behaviour (now that I finally grok 
> what's going
> on, it doesn't seem too difficult to fix).
> 
> I  didn't notice this problem until recently, since I was 
> instantiating
> a new store on every request (which is dumb).  Now I have one global
> store, which is the way (I think) MiddleKit was intended to be used
> (although the docs don't really say much about this -- it 
> would be good
> to add some of these "big picture" assumptions to the user guide).
> 
> Cheers,
> Jason
> 
> 

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to