#
#
-# Copyright (C) 2006, 2007 Google Inc.
+# Copyright (C) 2006, 2007, 2011 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
logging.error("LUXI request not a dict: %r", msg)
raise ProtocolError("Invalid LUXI request (not a dict)")
- method = request.get(KEY_METHOD, None) # pylint: disable-msg=E1103
- args = request.get(KEY_ARGS, None) # pylint: disable-msg=E1103
- version = request.get(KEY_VERSION, None) # pylint: disable-msg=E1103
+ method = request.get(KEY_METHOD, None) # pylint: disable=E1103
+ args = request.get(KEY_ARGS, None) # pylint: disable=E1103
+ version = request.get(KEY_VERSION, None) # pylint: disable=E1103
if method is None or args is None:
logging.error("LUXI request missing method or arguments: %r", msg)
# Parse the result
try:
data = serializer.LoadJson(msg)
+ except KeyboardInterrupt:
+ raise
except Exception, err:
raise ProtocolError("Error while deserializing response: %s" % str(err))
raise ProtocolError("Invalid response from server: %r" % data)
return (data[KEY_SUCCESS], data[KEY_RESULT],
- data.get(KEY_VERSION, None)) # pylint: disable-msg=E1103
+ data.get(KEY_VERSION, None)) # pylint: disable=E1103
def FormatResponse(success, result, version=None):
old_transp = self.transport
self.transport = None
old_transp.Close()
- except Exception: # pylint: disable-msg=W0703
+ except Exception: # pylint: disable=W0703
pass
def _SendMethodCall(self, data):
self._CloseTransport()
raise
+ def Close(self):
+ """Close the underlying connection.
+
+ """
+ self._CloseTransport()
+
def CallMethod(self, method, args):
"""Send a generic request and return the response.
def Query(self, what, fields, filter_):
"""Query for resources/items.
- @param what: One of L{constants.QR_OP_LUXI}
+ @param what: One of L{constants.QR_VIA_LUXI}
@type fields: List of strings
@param fields: List of requested fields
@type filter_: None or list
def QueryFields(self, what, fields):
"""Query for available fields.
- @param what: One of L{constants.QR_OP_LUXI}
+ @param what: One of L{constants.QR_VIA_LUXI}
@type fields: None or list of strings
@param fields: List of requested fields
@rtype: L{objects.QueryFieldsResponse}