Re: slooow delete
John Lenton <[email protected]> Tue, 15 Mar 2005 13:44:34 -0300
| Newsgroups | gmane.comp.python.modeling |
|---|---|
| Message-ID | <[email protected]> |
On 11 Mar 2005 22:19:37 +0100, Sebastien Bigaret <[email protected]> wrote: > > *Big fat warning* (!): do that if you're absolutely sure that the > related 'need', 'team' and 'mealType' objects are not already > fetched in other ECs, *or*, if they are fetched, that the "inverse" > tomany faults are not cleared. If I read you correctly then I'm safe, because I never do need.setTasks(None) (is this what you mean by clearing the tomany faults?) > > Respectively, check that (for 'need', same for 'team' and > 'mealType'): > > db=ec.rootObjectStore().objectStoreForObject(task).database() > > task_need_gID=task.getNeed().globalID() > db.snapshotForGlobalID(task_need_gID=task) # None if unfetched yet > > and if it's not None: > > db.snapshotForSourceGlobalID(task_need_gID, 'tasks') # should be () > > Otherwise you may experience weird side-effects on the corresponding > objects already fetched in other ECs, esp. when saving them (no > pb. if you use a single EC in the app., however). I'm not clear what the purpose of this is: is it to ensure that the task.setMeal(None) is safe? basically what I'll be doing, unless you tell me otherwise, is: - for creating, do the task.setMeal(meal) but not the meal.addToTasks(task) - for deleteing, do the task.setMeal(None) but not the meal.removeFromTasks(task) given that I never, ever (promise! :D) clear the tasks, and that I always saveChanges after deleteing or creating each task, although I have many editingContexts (inside zope, one per session using ZEditingContextSessioning), it is my understanding that I'll be safe. Right? -- John Lenton ([email protected]) -- Random fortune: Don't anthropomorphise computers and cars, They hate that. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click