##// END OF EJS Templates
payload.write_payload: use `single` keyword instead of `update`...
Pablo de Oliveira -
r12933:b8499e39
parent child
Show More
@@ -29,11 +29,17 class PayloadManager(Configurable):
29 29
30 30 _payload = List([])
31 31
32 def write_payload(self, data, update=False):
32 def write_payload(self, data, single=True):
33 """Include or update the specified `data` payload in the PayloadManager.
34
35 If a previous payload with the same source than `data` exists
36 and `single` is True, it will be overwritten with the new one.
37 """
38
33 39 if not isinstance(data, dict):
34 40 raise TypeError('Each payload write must be a dict, got: %r' % data)
35 41
36 if update and 'source' in data:
42 if single and 'source' in data:
37 43 source = data['source']
38 44 for i, pl in enumerate(self._payload):
39 45 if 'source' in pl and pl['source'] == source:
@@ -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, update=True)
586 self.payload_manager.write_payload(payload)
587 587
588 588 #-------------------------------------------------------------------------
589 589 # Things related to magics
General Comments 0
You need to be logged in to leave comments. Login now