Revision 0538c375 lib/objects.py
b/lib/objects.py | ||
---|---|---|
1392 | 1392 |
] |
1393 | 1393 |
|
1394 | 1394 |
|
1395 |
class _QueryResponseBase(ConfigObject): |
|
1396 |
__slots__ = [ |
|
1397 |
"fields", |
|
1398 |
] |
|
1399 |
|
|
1400 |
def ToDict(self): |
|
1401 |
"""Custom function for serializing. |
|
1402 |
|
|
1403 |
""" |
|
1404 |
mydict = super(_QueryResponseBase, self).ToDict() |
|
1405 |
mydict["fields"] = self._ContainerToDicts(mydict["fields"]) |
|
1406 |
return mydict |
|
1407 |
|
|
1408 |
@classmethod |
|
1409 |
def FromDict(cls, val): |
|
1410 |
"""Custom function for de-serializing. |
|
1411 |
|
|
1412 |
""" |
|
1413 |
obj = super(_QueryResponseBase, cls).FromDict(val) |
|
1414 |
obj.fields = cls._ContainerFromDicts(obj.fields, list, QueryFieldDefinition) |
|
1415 |
return obj |
|
1416 |
|
|
1417 |
|
|
1395 | 1418 |
class QueryRequest(ConfigObject): |
1396 | 1419 |
"""Object holding a query request. |
1397 | 1420 |
|
... | ... | |
1403 | 1426 |
] |
1404 | 1427 |
|
1405 | 1428 |
|
1406 |
class QueryResponse(ConfigObject):
|
|
1429 |
class QueryResponse(_QueryResponseBase):
|
|
1407 | 1430 |
"""Object holding the response to a query. |
1408 | 1431 |
|
1409 | 1432 |
@ivar fields: List of L{QueryFieldDefinition} objects |
... | ... | |
1411 | 1434 |
|
1412 | 1435 |
""" |
1413 | 1436 |
__slots__ = [ |
1414 |
"fields", |
|
1415 | 1437 |
"data", |
1416 | 1438 |
] |
1417 | 1439 |
|
... | ... | |
1426 | 1448 |
] |
1427 | 1449 |
|
1428 | 1450 |
|
1429 |
class QueryFieldsResponse(ConfigObject):
|
|
1451 |
class QueryFieldsResponse(_QueryResponseBase):
|
|
1430 | 1452 |
"""Object holding the response to a query for fields. |
1431 | 1453 |
|
1432 | 1454 |
@ivar fields: List of L{QueryFieldDefinition} objects |
1433 | 1455 |
|
1434 | 1456 |
""" |
1435 | 1457 |
__slots__ = [ |
1436 |
"fields", |
|
1437 | 1458 |
] |
1438 | 1459 |
|
1439 | 1460 |
|
Also available in: Unified diff