Show More
@@ -146,6 +146,9 class Application(SingletonConfigurable): | |||
|
146 | 146 | # The version string of this application. |
|
147 | 147 | version = Unicode(u'0.0') |
|
148 | 148 | |
|
149 | # the argv used to initialize the application | |
|
150 | argv = List(Unicode) | |
|
151 | ||
|
149 | 152 | # The log level for the application |
|
150 | 153 | log_level = Enum((0,10,20,30,40,50,'DEBUG','INFO','WARN','ERROR','CRITICAL'), |
|
151 | 154 | default_value=logging.WARN, |
@@ -457,6 +460,7 class Application(SingletonConfigurable): | |||
|
457 | 460 | def parse_command_line(self, argv=None): |
|
458 | 461 | """Parse the command line arguments.""" |
|
459 | 462 | argv = sys.argv[1:] if argv is None else argv |
|
463 | self.argv = list(argv) | |
|
460 | 464 | |
|
461 | 465 | if argv and argv[0] == 'help': |
|
462 | 466 | # turn `ipython help notebook` into `ipython notebook -h` |
@@ -53,6 +53,7 from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict, Set, Instan | |||
|
53 | 53 | # aliases and flags |
|
54 | 54 | |
|
55 | 55 | base_aliases = { |
|
56 | 'profile-dir' : 'ProfileDir.location', | |
|
56 | 57 | 'profile' : 'BaseIPythonApplication.profile', |
|
57 | 58 | 'ipython-dir' : 'BaseIPythonApplication.ipython_dir', |
|
58 | 59 | 'log-level' : 'Application.log_level', |
@@ -253,7 +253,7 aliases.update({ | |||
|
253 | 253 | aliases.pop('f', None) |
|
254 | 254 | |
|
255 | 255 | notebook_aliases = [u'port', u'port-retries', u'ip', u'keyfile', u'certfile', |
|
256 | u'notebook-dir'] | |
|
256 | u'notebook-dir', u'profile', u'profile-dir'] | |
|
257 | 257 | |
|
258 | 258 | #----------------------------------------------------------------------------- |
|
259 | 259 | # NotebookApp |
@@ -474,13 +474,6 class NotebookApp(BaseIPythonApplication): | |||
|
474 | 474 | |
|
475 | 475 | def parse_command_line(self, argv=None): |
|
476 | 476 | super(NotebookApp, self).parse_command_line(argv) |
|
477 | if argv is None: | |
|
478 | argv = sys.argv[1:] | |
|
479 | ||
|
480 | # Scrub frontend-specific flags | |
|
481 | self.kernel_argv = swallow_argv(argv, notebook_aliases, notebook_flags) | |
|
482 | # Kernel should inherit default config file from frontend | |
|
483 | self.kernel_argv.append("--IPKernelApp.parent_appname='%s'" % self.name) | |
|
484 | 477 | |
|
485 | 478 | if self.extra_args: |
|
486 | 479 | f = os.path.abspath(self.extra_args[0]) |
@@ -491,6 +484,15 class NotebookApp(BaseIPythonApplication): | |||
|
491 | 484 | nbdir = os.path.dirname(f) |
|
492 | 485 | self.config.NotebookManager.notebook_dir = nbdir |
|
493 | 486 | |
|
487 | def init_kernel_argv(self): | |
|
488 | """construct the kernel arguments""" | |
|
489 | # Scrub frontend-specific flags | |
|
490 | self.kernel_argv = swallow_argv(self.argv, notebook_aliases, notebook_flags) | |
|
491 | # Kernel should inherit default config file from frontend | |
|
492 | self.kernel_argv.append("--IPKernelApp.parent_appname='%s'" % self.name) | |
|
493 | # Kernel should get *absolute* path to profile directory | |
|
494 | self.kernel_argv.extend(["--profile-dir", self.profile_dir.location]) | |
|
495 | ||
|
494 | 496 | def init_configurables(self): |
|
495 | 497 | # force Session default to be secure |
|
496 | 498 | default_secure(self.config) |
@@ -657,6 +659,7 class NotebookApp(BaseIPythonApplication): | |||
|
657 | 659 | def initialize(self, argv=None): |
|
658 | 660 | self.init_logging() |
|
659 | 661 | super(NotebookApp, self).initialize(argv) |
|
662 | self.init_kernel_argv() | |
|
660 | 663 | self.init_configurables() |
|
661 | 664 | self.init_components() |
|
662 | 665 | self.init_webapp() |
@@ -71,7 +71,6 class ParallelCrashHandler(CrashHandler): | |||
|
71 | 71 | base_aliases = {} |
|
72 | 72 | base_aliases.update(base_ip_aliases) |
|
73 | 73 | base_aliases.update({ |
|
74 | 'profile-dir' : 'ProfileDir.location', | |
|
75 | 74 | 'work-dir' : 'BaseParallelApplication.work_dir', |
|
76 | 75 | 'log-to-file' : 'BaseParallelApplication.log_to_file', |
|
77 | 76 | 'clean-logs' : 'BaseParallelApplication.clean_logs', |
General Comments 0
You need to be logged in to leave comments.
Login now