Skip to content

Commit

Permalink
Merge pull request #211 from IlyaSkriblovsky/pymongo-3.5.0-compat
Browse files Browse the repository at this point in the history
Fixed compatibility with pymongo 3.5.0 (#210)
  • Loading branch information
psi29a committed Aug 10, 2017
2 parents 1c9e701 + 64561b7 commit 4856f77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions txmongo/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from pymongo.bulk import _Bulk, _COMMANDS, _merge_command
from pymongo.errors import InvalidName, BulkWriteError, InvalidOperation, OperationFailure
from pymongo.helpers import _check_write_command_response
from pymongo.operations import _WriteOp
from pymongo.message import _OP_MAP, _INSERT
from pymongo.results import InsertOneResult, InsertManyResult, UpdateResult, \
DeleteResult, BulkWriteResult
Expand Down Expand Up @@ -1204,9 +1203,10 @@ def bulk_write(self, requests, ordered=True):

blk = _Bulk(self, ordered, bypass_document_validation=False)
for request in requests:
if not isinstance(request, _WriteOp):
raise TypeError("{} is not a valid request".format(request))
request._add_to_bulk(blk)
try:
request._add_to_bulk(blk)
except AttributeError:
raise TypeError("{} is not valid request".format(request))

return self._execute_bulk(blk)

Expand Down

0 comments on commit 4856f77

Please sign in to comment.