|
@@ -36,8 +36,11 @@ import sys
|
36
|
36
|
import time
|
37
|
37
|
|
38
|
38
|
|
39
|
|
-logger_name = 'SOCKET_PROTOCOL'
|
40
|
|
-logger = logging.getLogger(logger_name)
|
|
39
|
+try:
|
|
40
|
+ from config import APP_NAME as ROOT_LOGGER_NAME
|
|
41
|
+except ImportError:
|
|
42
|
+ ROOT_LOGGER_NAME = 'root'
|
|
43
|
+logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
41
|
44
|
|
42
|
45
|
|
43
|
46
|
__DESCRIPTION__ = """The Module {\\tt %s} is designed to pack and unpack data for serial transportation.
|
|
@@ -75,10 +78,10 @@ class callback_storage(dict):
|
75
|
78
|
return self[None][None]
|
76
|
79
|
except KeyError:
|
77
|
80
|
pass # nothing to append
|
78
|
|
- return None
|
|
81
|
+ return (None, None, None)
|
79
|
82
|
|
80
|
83
|
def add(self, service_id, data_id, callback, *args, **kwargs):
|
81
|
|
- if self.get(service_id, data_id) is not None:
|
|
84
|
+ if self.get(service_id, data_id) != (None, None, None):
|
82
|
85
|
raise RegistrationError("Callback for service_id (%s) and data_id (%s) already exists" % (repr(service_id), repr(data_id)))
|
83
|
86
|
if service_id not in self:
|
84
|
87
|
self[service_id] = {}
|