Revision 2467e0d3 lib/luxi.py
b/lib/luxi.py | ||
---|---|---|
96 | 96 |
""" |
97 | 97 |
|
98 | 98 |
|
99 |
def SerializeJob(job): |
|
100 |
"""Convert a job description to a string format. |
|
101 |
|
|
102 |
""" |
|
103 |
return simplejson.dumps(job.__getstate__()) |
|
104 |
|
|
105 |
|
|
106 |
def UnserializeJob(data): |
|
107 |
"""Load a job from a string format""" |
|
108 |
try: |
|
109 |
new_data = simplejson.loads(data) |
|
110 |
except Exception, err: |
|
111 |
raise DecodingError("Error while unserializing: %s" % str(err)) |
|
112 |
job = opcodes.Job() |
|
113 |
job.__setstate__(new_data) |
|
114 |
return job |
|
115 |
|
|
116 |
|
|
117 | 99 |
class Transport: |
118 | 100 |
"""Low-level transport class. |
119 | 101 |
|
Also available in: Unified diff