Always default to OLD_UUID_SUBTYPE PYTHON-303
This commit is contained in:
parent
294c695dab
commit
1bb91c49d5
@ -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`).
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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("<I", options)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user