Fixed geo index creation bug

fixes MongoEngine/mongoengine#36
This commit is contained in:
Ross Lawley
2012-07-19 11:39:52 +01:00
parent 87ba69d02e
commit 1e51180d42
4 changed files with 23 additions and 8 deletions

View File

@@ -1113,7 +1113,11 @@ Invalid data to create a `%s` instance.\n%s""".strip() % (cls._class_name, error
inspected = inspected or []
geo_indices = []
inspected.append(cls)
from fields import EmbeddedDocumentField, GeoPointField
for field in cls._fields.values():
if not isinstance(field, (EmbeddedDocumentField, GeoPointField)):
continue
if hasattr(field, 'document_type'):
field_cls = field.document_type
if field_cls in inspected:

View File

@@ -483,7 +483,6 @@ class QuerySet(object):
self._collection.ensure_index(index_spec,
background=background, **index_opts)
@classmethod
def _build_index_spec(cls, doc_cls, spec):
"""Build a PyMongo index spec from a MongoEngine index spec.