Re: Using _pre_delete() to stop execution

2006-04-12 Thread Norbert
Thanks for the quick reply, Arthur. I've gone over the MR version of doing this, by overwriting delete(), which seems to be like a good approach. I have not tried to add it to my code, because due to some bad management, I'm currently not working on that particular code. In a way, the problem

Re: Using _pre_delete() to stop execution

2006-04-11 Thread olive
I totally agree with Glenn. Every day I suffer of the lack of example in the Python doc. It would be great that Django does it better. Olivier. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group

Re: Using _pre_delete() to stop execution

2006-04-11 Thread Glenn Tenney
On Tue, Apr 11, 2006 at 04:16:09PM -0400, Max Battcher wrote: > "pass" is the Python "do nothing" command, which is often used as an > indicator to "fill in the blanks" with your own specific code (because > Python doesn't allow empty functions it is often seen in psuedo-code). yes... yes... I kn

Re: Using _pre_delete() to stop execution

2006-04-11 Thread Max Battcher
On 4/11/06, Glenn Tenney <[EMAIL PROTECTED]> wrote: > > On Tue, Apr 11, 2006 at 02:24:04PM -0400, Max Battcher wrote: > > You are free to raise your own exception in the path that fails to > > call super().delete() in M-R. > > Then perhaps the docs etc. should instead show "raise " > instead of "p

Re: Using _pre_delete() to stop execution

2006-04-11 Thread Glenn Tenney
On Tue, Apr 11, 2006 at 06:19:49PM -, arthur debert wrote: > the thing is, if there's anything in django's knowledge to avoid the > save / delete it DOES raise an error. (such as trying to delete an non > existant object or trying to save a model that does not pass > validation). my guess here

Re: Using _pre_delete() to stop execution

2006-04-11 Thread Glenn Tenney
On Tue, Apr 11, 2006 at 02:24:04PM -0400, Max Battcher wrote: > You are free to raise your own exception in the path that fails to > call super().delete() in M-R. Then perhaps the docs etc. should instead show "raise " instead of "pass"... When one shows as an example to use "pass", it misleads

Re: Using _pre_delete() to stop execution

2006-04-11 Thread Max Battcher
On 4/11/06, Glenn Tenney <[EMAIL PROTECTED]> wrote: > > On Tue, Apr 11, 2006 at 05:01:39PM -, arthur debert wrote: > > more on this here: > > http://code.djangoproject.com/wiki/RemovingTheMagic#Addedamorepowerfulwayofoverridingmodelmethodsremovedhardcoded_pre_save_post_saveetc. > > > Everythin

Re: Using _pre_delete() to stop execution

2006-04-11 Thread arthur debert
Hi Glenn. the thing is, if there's anything in django's knowledge to avoid the save / delete it DOES raise an error. (such as trying to delete an non existant object or trying to save a model that does not pass validation). my guess here is if you need anything else in you logic that django does

Re: Using _pre_delete() to stop execution

2006-04-11 Thread Glenn Tenney
On Tue, Apr 11, 2006 at 05:01:39PM -, arthur debert wrote: > more on this here: > http://code.djangoproject.com/wiki/RemovingTheMagic#Addedamorepowerfulwayofoverridingmodelmethodsremovedhardcoded_pre_save_post_saveetc. Everything that I read there shows that you can choose to save or not-sav

Re: Using _pre_delete() to stop execution

2006-04-11 Thread arthur debert
Hi Norbert, this is not possible on trunk , if you are using magic-removal, you can do it like this: def delete(self): if conditionIsMet == True: super(ModelName, self).delete() # Call the "real" delete() method. else: # Don't delete. pass more