Skip to content
Browse files

add config file inheritance to kernelapp

Add KernelApp.parent_appname configurable, which sets the default config file.  Frontends should specify this in the arguments they pass to kernels they start.

closes gh-544
  • Loading branch information...
1 parent cc3e7f7 commit e147141c12a5f2861161bb9c5474cbb32bcf8bff @minrk minrk committed Jun 29, 2011
Showing with 13 additions and 2 deletions.
  1. +2 −1 IPython/frontend/qt/console/qtconsoleapp.py
  2. +11 −1 IPython/zmq/kernelapp.py
View
3 IPython/frontend/qt/console/qtconsoleapp.py
@@ -292,7 +292,8 @@ def parse_command_line(self, argv=None):
argv = sys.argv[1:]
self.kernel_argv = list(argv) # copy
-
+ # kernel should inherit default config file from frontend
+ self.kernel_argv.append("KernelApp.parent_appname='%s'"%self.name)
# scrub frontend-specific flags
for a in argv:
if a.startswith('--') and a[2:] in qt_flags:
View
12 IPython/zmq/kernelapp.py
@@ -82,7 +82,17 @@ class KernelApp(BaseIPythonApplication):
heartbeat = Instance(Heartbeat)
session = Instance('IPython.zmq.session.Session')
ports = Dict()
-
+
+ # inherit config file name from parent:
+ parent_appname = Unicode(config=True)
+ def _parent_appname_changed(self, name, old, new):
+ if self.config_file_specified:
+ # it was manually specified, ignore
+ return
+ self.config_file_name = new.replace('-','_') + u'_config.py'
+ # don't let this count as specifying the config file
+ self.config_file_specified = False
+
# connection info:
ip = Unicode(LOCALHOST, config=True,
help="Set the IP or interface on which the kernel will listen.")

0 comments on commit e147141

Please sign in to comment.
Something went wrong with that request. Please try again.