~ubuntu-branches/ubuntu/wily/pymongo/wily

« back to all changes in this revision

Viewing changes to pymongo/message.py

  • Committer: Package Import Robot
  • Author(s): Federico Ceratto
  • Date: 2012-05-10 21:21:40 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20120510212140-9c66c00zz850h6l9
Tags: 2.2-1
* New upstream release.
* Dependencies added (Closes: #670268)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2010 10gen, Inc.
 
1
# Copyright 2009-2012 10gen, Inc.
2
2
#
3
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
4
# you may not use this file except in compliance with the License.
27
27
 
28
28
import bson
29
29
from bson.binary import OLD_UUID_SUBTYPE
 
30
from bson.py3compat import b
30
31
from bson.son import SON
31
32
try:
32
33
    from pymongo import _cmessage
36
37
from pymongo.errors import InvalidOperation
37
38
 
38
39
 
39
 
__ZERO = "\x00\x00\x00\x00"
 
40
__ZERO = b("\x00\x00\x00\x00")
 
41
 
 
42
EMPTY  = b("")
40
43
 
41
44
MAX_INT32 = 2147483647
42
45
MIN_INT32 = -2147483648
77
80
    if not encoded:
78
81
        raise InvalidOperation("cannot do an empty bulk insert")
79
82
    max_bson_size = max(map(len, encoded))
80
 
    data += "".join(encoded)
 
83
    data += EMPTY.join(encoded)
81
84
    if safe:
82
85
        (_, insert_message) = __pack_message(2002, data)
83
86
        (request_id, error_message, _) = __last_error(last_error_args)