Minor bugfixes

This commit is contained in:
Harry Marr 2010-01-07 15:24:52 +00:00
parent f86496b545
commit 2e74c93878
2 changed files with 2 additions and 4 deletions

View File

@ -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.

View File

@ -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: