Minor bugfixes
This commit is contained in:
parent
f86496b545
commit
2e74c93878
@ -202,9 +202,7 @@ class BaseDocument(object):
|
||||
return all_subclasses
|
||||
|
||||
def __iter__(self):
|
||||
# Use _data rather than _fields as iterator only looks at names so
|
||||
# values don't need to be converted to Python types
|
||||
return iter(self._data)
|
||||
return iter(self._fields)
|
||||
|
||||
def __getitem__(self, name):
|
||||
"""Dictionary-style field access, return a field's value if present.
|
||||
|
@ -132,7 +132,7 @@ class QuerySet(object):
|
||||
"""Retrieve the object matching the id provided.
|
||||
"""
|
||||
if not isinstance(object_id, pymongo.objectid.ObjectId):
|
||||
object_id = pymongo.objectid.ObjectId(object_id)
|
||||
object_id = pymongo.objectid.ObjectId(str(object_id))
|
||||
|
||||
result = self._collection.find_one(object_id)
|
||||
if result is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user