##// END OF EJS Templates
Make session subheader default configurable
Jason Grout -
Show More
@@ -49,7 +49,7 b' from IPython.utils.importstring import import_item'
49 49 from IPython.utils.jsonutil import extract_dates, squash_dates, date_default
50 50 from IPython.utils.py3compat import str_to_bytes
51 51 from IPython.utils.traitlets import (CBytes, Unicode, Bool, Any, Instance, Set,
52 DottedObjectName, CUnicode)
52 DottedObjectName, CUnicode, Dict)
53 53
54 54 #-----------------------------------------------------------------------------
55 55 # utility functions
@@ -292,6 +292,9 b' class Session(Configurable):'
292 292 username = Unicode(os.environ.get('USER',u'username'), config=True,
293 293 help="""Username for the Session. Default is your system username.""")
294 294
295 subheader = Dict({}, config=True,
296 help="""Subheader dictionary, which serves as the default subheader fields for each message.""")
297
295 298 # message signature related traits:
296 299
297 300 key = CBytes(b'', config=True,
@@ -416,8 +419,9 b' class Session(Configurable):'
416 419 msg['msg_type'] = header['msg_type']
417 420 msg['parent_header'] = {} if parent is None else extract_header(parent)
418 421 msg['content'] = {} if content is None else content
419 sub = {} if subheader is None else subheader
420 msg['header'].update(sub)
422 msg['header'].update(self.subheader)
423 if subheader is not None:
424 msg['header'].update(subheader)
421 425 return msg
422 426
423 427 def sign(self, msg_list):
General Comments 0
You need to be logged in to leave comments. Login now