Line 0
Link Here
|
|
|
1 |
--- ./src/txamqp/codec.py.orig 2009-08-16 19:25:45.000000000 +0800 |
2 |
+++ ./src/txamqp/codec.py 2013-05-30 13:54:50.000000000 +0800 |
3 |
@@ -25,12 +25,12 @@ |
4 |
""" |
5 |
|
6 |
from cStringIO import StringIO |
7 |
-from struct import * |
8 |
+from struct import pack, calcsize, unpack |
9 |
|
10 |
class EOF(Exception): |
11 |
pass |
12 |
|
13 |
-class Codec: |
14 |
+class Codec(object): |
15 |
|
16 |
def __init__(self, stream): |
17 |
self.stream = stream |
18 |
@@ -153,6 +153,13 @@ |
19 |
def decode_longstr(self): |
20 |
return self.dec_str("!L") |
21 |
|
22 |
+ # timestamp |
23 |
+ def encode_timestamp(self, o): |
24 |
+ self.pack("!Q", o) |
25 |
+ |
26 |
+ def decode_timestamp(self): |
27 |
+ return self.unpack("!Q") |
28 |
+ |
29 |
# table |
30 |
def encode_table(self, tbl): |
31 |
enc = StringIO() |
32 |
@@ -180,6 +187,10 @@ |
33 |
value = self.decode_longstr() |
34 |
elif type == "I": |
35 |
value = self.decode_long() |
36 |
+ elif type == "F": |
37 |
+ value = self.decode_table() |
38 |
+ elif type == "t": |
39 |
+ value = (self.decode_octet() != 0) |
40 |
else: |
41 |
raise ValueError(repr(type)) |
42 |
result[key] = value |