On May 25, 9:19 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Mon, May 25, 2009 at 12:42 PM, Viktor <viktor.n...@gmail.com> wrote: > > > Hi, > > > I have the following abstract model, but it's child models fail saving > > with RuntimeError: maximum recursion depth exceeded > > When you get that error, it comes with a stack trace. Does that not make it > clear how the code is getting into an apparently infinite loop? It's > usually easier to see in the stack trace than the code, since if it had been > obvious in the code it likely would have been avoided. > > Karen
I've simplified the save method to contain only the super call, and the stack trace points at it super(self.__class__, self).save(force_insert, force_update) exclusively. That is, my test calls a Mymodel.objects.create() at line 1045, and then Mymodel.save is called that was defined in the abstract model. Traceback (most recent call last): File "/home/nagyv/workspace/MKKE/conference/tests.py", line 1045, in setUp accepted=False) File "/home/nagyv/virtualenv/django-1.0.2/lib/python2.5/site- packages/Django-1.0.2_final-py2.5.egg/django/db/models/manager.py", line 99, in create return self.get_query_set().create(**kwargs) File "/home/nagyv/virtualenv/django-1.0.2/lib/python2.5/site- packages/Django-1.0.2_final-py2.5.egg/django/db/models/query.py", line 319, in create obj.save(force_insert=True) File "/home/nagyv/workspace/MKKE/conference/models.py", line 211, in save super(self.__class__, self).save(force_insert, force_update) ... File "/home/nagyv/workspace/MKKE/conference/models.py", line 211, in save super(self.__class__, self).save(force_insert, force_update) RuntimeError: maximum recursion depth exceeded I have tried many variants, like moving the save method to the child models without getting rid of the save method of the abstract model, and with deleting it totally. In the latter case there are no problems at all. In the former (when the abstract model has a ``super(self.__class__, self).save (force_insert, force_update)`` save method) the same recursion occurs. any ideas? V --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---