(self, value)
explicit state set from pickling
explicit state set from pickling
explicit state set from pickling
def __setstate__(self, value):
        """explicit state set from pickling
        """
        # Provide backwards compatibility with OIDs
        # pickled with pymongo-1.9 or older.
        if isinstance(value, dict):
            oid = value["_ObjectId__id"]
        else:
            oid = value
        # ObjectIds pickled in python 2.x used `str` for __id.
        # In python 3.x this has to be converted to `bytes`
        # by encoding latin-1.
        if PY3 and isinstance(oid, text_type):
            self.__id = oid.encode('latin-1')
        else:
            self.__id = oid
def __setstate__ ( self , value ) : # Provide backwards compatibility with OIDs # pickled with pymongo-1.9 or older. if isinstance ( value , dict ) : oid = value [ "_ObjectId__id" ] else : oid = value # ObjectIds pickled in python 2.x used `str` for __id. # In python 3.x this has to be converted to `bytes` # by encoding latin-1. if PY3 and isinstance ( oid , text_type ) : self . __id = oid . encode ( 'latin-1' ) else : self . __id = oid