JSON validator for message payload. If that value is missing or null, it is treated as if it were {}.
(value)
| 409 | |
| 410 | |
| 411 | def _payload(value): |
| 412 | """JSON validator for message payload. |
| 413 | |
| 414 | If that value is missing or null, it is treated as if it were {}. |
| 415 | """ |
| 416 | |
| 417 | if value is not None and value != (): |
| 418 | if isinstance(value, dict): # can be int, str, list... |
| 419 | assert isinstance(value, MessageDict) |
| 420 | return value |
| 421 | |
| 422 | # Missing payload. Construct a dummy MessageDict, and make it look like it was |
| 423 | # deserialized. See JsonMessageChannel._parse_incoming_message for why it needs |
| 424 | # to have associate_with(). |
| 425 | |
| 426 | def associate_with(message): |
| 427 | value.message = message |
| 428 | |
| 429 | value = MessageDict(None) |
| 430 | value.associate_with = associate_with |
| 431 | return value |
| 432 | |
| 433 | |
| 434 | class Message(object): |
nothing calls this directly
no test coverage detected
searching dependent graphs…