Re: [Modeling-users] slooow delete
Status: Abandoned
Brought to you by:
sbigaret
|
From: John L. <jl...@gm...> - 2005-03-15 16:44:45
|
On 11 Mar 2005 22:19:37 +0100, Sebastien Bigaret
<sbi...@us...> 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 (jl...@gm...) -- Random fortune:
Don't anthropomorphise computers and cars, They hate that.
|