Skip to content

Commit

Permalink
Raise if inappropriate bson module is installed (Appease #198) (#270)
Browse files Browse the repository at this point in the history
* Raise Exception if inappropriate bson module is installed (Related to #198)
  • Loading branch information
ledmonster authored and jihoonl committed Nov 20, 2017
1 parent f0d3597 commit a2f0149
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@
import re
import string
from base64 import standard_b64encode, standard_b64decode
import bson

from rosbridge_library.util import string_types
from rosbridge_library.util import string_types, bson

import sys
if sys.version_info >= (3, 0):
Expand Down
3 changes: 1 addition & 2 deletions rosbridge_library/src/rosbridge_library/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@

import rospy
import time
import bson
from rosbridge_library.internal.exceptions import InvalidArgumentException
from rosbridge_library.internal.exceptions import MissingArgumentException

#from rosbridge_library.internal.pngcompression import encode
from rosbridge_library.capabilities.fragmentation import Fragmentation
from rosbridge_library.util import json
from rosbridge_library.util import json, bson


def is_number(s):
Expand Down
10 changes: 10 additions & 0 deletions rosbridge_library/src/rosbridge_library/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
string_types = (str,)
else:
string_types = (str, unicode)

import bson
try:
bson.BSON
except AttributeError:
raise Exception(
"BSON installation does not support all necessary features. "
"Please use the MongoDB BSON implementation. "
"See: https://github.com/RobotWebTools/rosbridge_suite/issues/198"
)
3 changes: 1 addition & 2 deletions rosbridge_server/src/rosbridge_server/udp_handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import rospy
from rosbridge_library.rosbridge_protocol import RosbridgeProtocol
from rosbridge_library.util import json
import bson
from rosbridge_library.util import json, bson

from twisted.internet.protocol import DatagramProtocol,Factory

Expand Down
3 changes: 1 addition & 2 deletions rosbridge_server/src/rosbridge_server/websocket_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
from tornado.websocket import WebSocketHandler

from rosbridge_library.rosbridge_protocol import RosbridgeProtocol
from rosbridge_library.util import json
import bson
from rosbridge_library.util import json, bson

class RosbridgeWebSocket(WebSocketHandler):
client_id_seed = 0
Expand Down

0 comments on commit a2f0149

Please sign in to comment.