Open lucashowell opened 11 years ago
Sadly no. And I also just noticed that I messed up adding those bloody tags for 0.3 so it would help a lot if you could a) test with the current version from github and b) post the stack trace (as useless as they seem, they do tend to at least show which recursion doesn't stop).
From the top of my head the only place where recursion is used is during field generation. But that should stop. So no. Can't help you easily, but I'm happy to look into it :)
Here's the stack trace - sorry for the delay! At the top I've listed all the libraries installed in my environment in case that is helpful as well.
Pip Freeze:
Django==1.5.1
MySQL-python==1.2.4
PIL==1.1.7
Whoosh==2.4.0
argparse==1.2.1
distribute==0.7.3
django-crispy-forms==1.3.2
django-haystack==2.0.0
ipython==0.13.2
matplotlib==1.2.1
mongodbforms==0.2.2
mongoengine==0.8.4
numpy==1.7.1
pycurl==7.19.0
pymongo==2.6.3
pytz==2013b
pyzmq==13.1.0
scipy==0.12.0
simplejson==3.3.0
tornado==3.1
wsgiref==0.1.2
Environment:
Request Method: GET
Request URL: https://pivot.example.org/pivot/viz/grid/
Django Version: 1.5.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mongoengine.django.mongo_auth',
'crispy_forms',
'dataportal.accounts',
'dataportal.calibrations',
'dataportal.configs',
'dataportal.core',
'dataportal.deployments',
'dataportal.devices',
'dataportal.metrics',
'dataportal.sms',
'dataportal.uploads',
'dataportal.viz')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Template error:
In template /var/www/pivot/projects/dataportal/dataportal/templates/viz/viz_deployment_grid_pivot.html, error at line 22
maximum recursion depth exceeded in cmp
12 : <h1>{{ page_title }}</h1>
13 : </div>
14 : </div>
15 : {% endblock %}
16 :
17 : {% block content %}
18 :
19 : <div class="row">
20 : <div class="span9 offset3">
21 : <div class="well">
22 : <form class="grid_viz_form" method="post" action=" {% url 'api_deployment_grid_alldev' %} ">
23 : <div class="field_container">
24 : {{ form.deployment }}
25 : <div class="help_text">
26 : {{ form.deployment.help_text }}
27 : </div>
28 : </div>
29 : <div class="field_container">
30 : {{ form.year }}
31 : <div class="help_text">
32 : {{ form.year.help_text }}
Traceback:
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/pivot/projects/dataportal/dataportal/viz/views.py" in viz_deployment_grid
45. context_instance=RequestContext(request))
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render_to_response
29. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
177. return t.render(context_instance)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/base.py" in render
140. return self._render(context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/base.py" in _render
134. return self.nodelist.render(context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/base.py" in render
830. bit = self.render_node(node, context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/debug.py" in render_node
74. return node.render(context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/loader_tags.py" in render
124. return compiled_parent._render(context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/base.py" in _render
134. return self.nodelist.render(context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/base.py" in render
830. bit = self.render_node(node, context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/debug.py" in render_node
74. return node.render(context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/loader_tags.py" in render
63. result = block.nodelist.render(context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/base.py" in render
830. bit = self.render_node(node, context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/debug.py" in render_node
74. return node.render(context)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/template/defaulttags.py" in render
413. url = reverse(view_name, args=args, kwargs=kwargs, current_app=context.current_app)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/urlresolvers.py" in reverse
496. return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
382. possibilities = self.reverse_dict.getlist(lookup_view)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/urlresolvers.py" in reverse_dict
297. self._populate()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/urlresolvers.py" in _populate
274. for name in pattern.reverse_dict:
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/urlresolvers.py" in reverse_dict
297. self._populate()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/urlresolvers.py" in _populate
286. lookups.appendlist(pattern.callback, (bits, p_pattern, pattern.default_args))
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/urlresolvers.py" in callback
230. self._callback = get_callable(self._callback_str)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/utils/functional.py" in wrapper
31. result = func(*args)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/core/urlresolvers.py" in get_callable
97. mod = import_module(mod_name)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
35. __import__(name)
File "/var/www/pivot/projects/dataportal/dataportal/admin/views.py" in <module>
16. from dataportal.admin.forms import DeploymentForm, EquipmentForm, \
File "/var/www/pivot/projects/dataportal/dataportal/admin/forms.py" in <module>
138. class EquipmentForm(DocumentForm):
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documents.py" in __new__
307. opts = new_class._meta = ModelFormOptions(getattr(new_class, 'Meta', None))
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documents.py" in __init__
283. self.document._meta = DocumentMetaWrapper(self.document)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
97. f.document_type._meta = DocumentMetaWrapper(f.document_type)
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in __init__
71. self._setup_document_fields()
File "/home/lucas/.virtualenvs/ttracker/lib/python2.7/site-packages/mongodbforms/documentoptions.py" in _setup_document_fields
96. if isinstance(f, ReferenceField) and not isinstance(f.document_type._meta, DocumentMetaWrapper):
File "/usr/lib/python2.7/abc.py" in __instancecheck__
141. subtype in cls._abc_negative_cache):
File "/usr/lib/python2.7/_weakrefset.py" in __contains__
73. return wr in self.data
Exception Type: RuntimeError at /viz/grid/
Exception Value: maximum recursion depth exceeded in cmp
Okay, as far as I can tell the document associated with your EquipmentForm
uses some kind of ReferenceField
. For various Django related reasons we monkey patch the _meta
attribute of related documents. In your case the check to see if it is a reference to self
seems to fail.
Could you copy & paste this document? It looks to me like the check that is used to guard from the infinite recursion is wrong and needs to be changed. But for that I would need to see what you do in your documents :)
So, I took a closer look at it today and found an infinite recursion with two documents that reference each other like so:
class ReferenceTestOne(Document):
ref_to_two = ReferenceField('ReferenceTestTwo')
class ReferenceTestTwo(Document):
ref_to_one = ReferenceField(ReferenceTestOne)
Not sure if you do that in your application, but if you do it should hopefully work now with the above commit.
I've been using MongoDbForms on a large project for quite a while and it's working great! Thanks! However, when I updated to the latest version (0.3), it's causing a maximum recursion depth exceeded error sitewide, with no real clarity in the stacktrace. Do you have any thoughts on why this might be occurring?
Thanks!
Lucas