diff --git a/bson/__init__.py b/bson/__init__.py index b8a46c0ad..48af442c3 100644 --- a/bson/__init__.py +++ b/bson/__init__.py @@ -21,7 +21,7 @@ import re import struct import warnings -from bson.binary import Binary, UUID_SUBTYPE +from bson.binary import Binary, OLD_UUID_SUBTYPE from bson.code import Code from bson.dbref import DBRef from bson.errors import (InvalidBSON, @@ -467,7 +467,7 @@ class BSON(str): """ @classmethod - def from_dict(cls, dct, check_keys=False): + def from_dict(cls, dct, check_keys=False, uuid_subtype=OLD_UUID_SUBTYPE): """DEPRECATED - `from_dict` has been renamed to `encode`. .. versionchanged:: 1.9 @@ -475,10 +475,10 @@ class BSON(str): """ warnings.warn("`from_dict` has been renamed to `encode`", DeprecationWarning) - return cls.encode(dct, check_keys) + return cls.encode(dct, check_keys, uuid_subtype) @classmethod - def encode(cls, document, check_keys=False, uuid_subtype=UUID_SUBTYPE): + def encode(cls, document, check_keys=False, uuid_subtype=OLD_UUID_SUBTYPE): """Encode a document to a new :class:`BSON` instance. A document can be any mapping type (like :class:`dict`). diff --git a/pymongo/_cmessagemodule.c b/pymongo/_cmessagemodule.c index 2308d4ba9..3e8bd0c13 100644 --- a/pymongo/_cmessagemodule.c +++ b/pymongo/_cmessagemodule.c @@ -326,7 +326,7 @@ static PyObject* _cbson_query_message(PyObject* self, PyObject* args) { int num_to_return; PyObject* query; PyObject* field_selector = Py_None; - unsigned char uuid_subtype = 4; + unsigned char uuid_subtype = 3; buffer_t buffer; int length_location, message_length; PyObject* result; diff --git a/pymongo/message.py b/pymongo/message.py index 140c98399..1ab7a3246 100644 --- a/pymongo/message.py +++ b/pymongo/message.py @@ -26,6 +26,7 @@ import random import struct import bson +from bson.binary import OLD_UUID_SUBTYPE from bson.son import SON try: from pymongo import _cmessage @@ -116,7 +117,8 @@ if _use_c: def query(options, collection_name, num_to_skip, - num_to_return, query, field_selector=None, uuid_subtype=4): + num_to_return, query, field_selector=None, + uuid_subtype=OLD_UUID_SUBTYPE): """Get a **query** message. """ data = struct.pack("