Merge branch 'master' of git://github.com/flosch/mongoengine into v0.4
This commit is contained in:
commit
9540555b26
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
*.pyc
|
||||
.*.swp
|
||||
*.egg
|
||||
docs/.build
|
||||
docs/_build
|
||||
build/
|
||||
|
@ -257,7 +257,7 @@ class TopLevelDocumentMetaclass(DocumentMetaclass):
|
||||
new_class = super_new(cls, name, bases, attrs)
|
||||
|
||||
# Provide a default queryset unless one has been manually provided
|
||||
if not 'objects' in dir(new_class):
|
||||
if not hasattr(new_class, 'objects'):
|
||||
new_class.objects = QuerySetManager()
|
||||
|
||||
user_indexes = [QuerySet._build_index_spec(new_class, spec)
|
||||
@ -418,11 +418,8 @@ class BaseDocument(object):
|
||||
self._meta.get('allow_inheritance', True) == False):
|
||||
data['_cls'] = self._class_name
|
||||
data['_types'] = self._superclasses.keys() + [self._class_name]
|
||||
try:
|
||||
if not data['_id']:
|
||||
del data['_id']
|
||||
except KeyError:
|
||||
pass
|
||||
if data.has_key('_id') and not data['_id']:
|
||||
del data['_id']
|
||||
return data
|
||||
|
||||
@classmethod
|
||||
|
Loading…
x
Reference in New Issue
Block a user