Show More
@@ -27,18 +27,6 b' from zmq.eventloop.zmqstream import ZMQStream' | |||||
27 |
|
27 | |||
28 | from .util import ISO8601 |
|
28 | from .util import ISO8601 | |
29 |
|
29 | |||
30 | # packer priority: jsonlib[2], cPickle, simplejson/json, pickle |
|
|||
31 | json_name = '' if not jsonapi.jsonmod else jsonapi.jsonmod.__name__ |
|
|||
32 | if json_name in ('jsonlib', 'jsonlib2'): |
|
|||
33 | use_json = True |
|
|||
34 | elif json_name: |
|
|||
35 | if cPickle is None: |
|
|||
36 | use_json = True |
|
|||
37 | else: |
|
|||
38 | use_json = False |
|
|||
39 | else: |
|
|||
40 | use_json = False |
|
|||
41 |
|
||||
42 | def squash_unicode(obj): |
|
30 | def squash_unicode(obj): | |
43 | if isinstance(obj,dict): |
|
31 | if isinstance(obj,dict): | |
44 | for key in obj.keys(): |
|
32 | for key in obj.keys(): | |
@@ -58,12 +46,8 b' json_unpacker = lambda s: squash_unicode(jsonapi.loads(s))' | |||||
58 | pickle_packer = lambda o: pickle.dumps(o,-1) |
|
46 | pickle_packer = lambda o: pickle.dumps(o,-1) | |
59 | pickle_unpacker = pickle.loads |
|
47 | pickle_unpacker = pickle.loads | |
60 |
|
48 | |||
61 | if use_json: |
|
49 | default_packer = json_packer | |
62 |
|
|
50 | default_unpacker = json_unpacker | |
63 | default_unpacker = json_unpacker |
|
|||
64 | else: |
|
|||
65 | default_packer = pickle_packer |
|
|||
66 | default_unpacker = pickle_unpacker |
|
|||
67 |
|
51 | |||
68 |
|
52 | |||
69 | DELIM="<IDS|MSG>" |
|
53 | DELIM="<IDS|MSG>" |
General Comments 0
You need to be logged in to leave comments.
Login now