Show More
@@ -29,9 +29,17 class PayloadManager(Configurable): | |||
|
29 | 29 | |
|
30 | 30 | _payload = List([]) |
|
31 | 31 | |
|
32 | def write_payload(self, data): | |
|
32 | def write_payload(self, data, update=False): | |
|
33 | 33 | if not isinstance(data, dict): |
|
34 | 34 | raise TypeError('Each payload write must be a dict, got: %r' % data) |
|
35 | ||
|
36 | if update and 'source' in data: | |
|
37 | source = data['source'] | |
|
38 | for i,pl in enumerate(self._payload): | |
|
39 | if 'source' in pl and pl['source'] == source: | |
|
40 | self._payload[i] = data | |
|
41 | return | |
|
42 | ||
|
35 | 43 | self._payload.append(data) |
|
36 | 44 | |
|
37 | 45 | def read_payload(self): |
@@ -583,7 +583,7 class ZMQInteractiveShell(InteractiveShell): | |||
|
583 | 583 | source='set_next_input', |
|
584 | 584 | text=text |
|
585 | 585 | ) |
|
586 | self.payload_manager.write_payload(payload) | |
|
586 | self.payload_manager.write_payload(payload, update=True) | |
|
587 | 587 | |
|
588 | 588 | #------------------------------------------------------------------------- |
|
589 | 589 | # Things related to magics |
General Comments 0
You need to be logged in to leave comments.
Login now