Permalink
Browse files

ObjectId.__str__ should return str in 2.x.

This addresses the issue raised in pull request
155.
  • Loading branch information...
1 parent 890fc92 commit c8f6d4aa0310e894adf6ad43c320a0fa03a0abfb @behackett behackett committed Feb 9, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 bson/objectid.py
View
@@ -244,7 +244,9 @@ def __setstate__(self, value):
self.__id = oid
def __str__(self):
- return binascii.hexlify(self.__id).decode()
+ if PY3:
+ return binascii.hexlify(self.__id).decode()
+ return binascii.hexlify(self.__id)
def __repr__(self):
return "ObjectId('%s')" % (str(self),)

0 comments on commit c8f6d4a

Please sign in to comment.