diff options
| author | Martin Willi <martin@revosec.ch> | 2015-02-27 14:30:34 +0100 |
|---|---|---|
| committer | Martin Willi <martin@revosec.ch> | 2015-03-18 13:59:14 +0100 |
| commit | 305023a27d97653b67510035edc95ccf26599ede (patch) | |
| tree | b2a51043d3d5576122ce7b32b71fb6534e07f421 /src/libcharon/plugins/vici/python | |
| parent | 94bb26fae39d97fca6b1187797dc59ae6f9eca9e (diff) | |
| download | strongswan-305023a27d97653b67510035edc95ccf26599ede.tar.bz2 strongswan-305023a27d97653b67510035edc95ccf26599ede.tar.xz | |
vici: Use OrderedDict to handle vici responses in Python library
The default Python dictionaries are unordered, but order is important for some
vici trees (for example the order of authentication rounds).
Diffstat (limited to 'src/libcharon/plugins/vici/python')
| -rw-r--r-- | src/libcharon/plugins/vici/python/vici/protocol.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libcharon/plugins/vici/python/vici/protocol.py b/src/libcharon/plugins/vici/python/vici/protocol.py index 60b94ede9..88e1c3470 100644 --- a/src/libcharon/plugins/vici/python/vici/protocol.py +++ b/src/libcharon/plugins/vici/python/vici/protocol.py @@ -3,6 +3,7 @@ import socket import struct from collections import namedtuple +from collections import OrderedDict from .exception import DeserializationException @@ -150,13 +151,13 @@ class Message(object): "Expected end of list at {pos}".format(pos=stream.tell()) ) - section = {} + section = OrderedDict() section_stack = [] while stream.has_more(): element_type, = struct.unpack("!B", stream.read(1)) if element_type == cls.SECTION_START: section_name = decode_named_type(stream) - new_section = {} + new_section = OrderedDict() section[section_name] = new_section section_stack.append(section) section = new_section |
