Skip to content

Commit 81e99d8

Browse files
committed
more details on SimpleExt11 configs
1 parent cab94b7 commit 81e99d8

File tree

2 files changed

+43
-5
lines changed

2 files changed

+43
-5
lines changed

examples/simple/README.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,49 @@ Try with the above links to check that only Extension 2 is responding (Extension
100100

101101
## Extension 11 extending Extension 1
102102

103-
`Extension 11` extends `Extension 1`. It also implemnets additional flags and aliases.
103+
`Extension 11` extends `Extension 1`.
104104

105-
The `--hello` flag will log on startup `Hello Simple11 - You have provided the --hello flag or defined a c.SimpleApp1.hello == True`.
105+
It brings a few more configs. Run `jupyter simple-ext11 --generate-config && vi ~/.jupyter/jupyter_config.py`.
106106

107-
The `--simple11-dir` alias will set `SimpleExt11.simple11_dir` settings.
107+
The generated configuration should contains the following.
108+
109+
```bash
110+
...
111+
# Can be used to override templates from notebook.templates.
112+
#c.ExtensionApp.template_paths = []
113+
114+
#------------------------------------------------------------------------------
115+
# SimpleApp1(ExtensionApp) configuration
116+
#------------------------------------------------------------------------------
117+
118+
#------------------------------------------------------------------------------
119+
# SimpleApp11(SimpleApp1) configuration
120+
#------------------------------------------------------------------------------
121+
122+
## Say hello
123+
#c.SimpleApp11.hello = False
124+
125+
## Ignore Javascript
126+
#c.SimpleApp11.ignore_js = False
127+
128+
## Simple directory
129+
#c.SimpleApp11.simple11_dir = ''
130+
131+
#------------------------------------------------------------------------------
132+
# ServerApp(JupyterApp) configuration
133+
#------------------------------------------------------------------------------
134+
135+
## Set the Access-Control-Allow-Credentials: true header
136+
#c.ServerApp.allow_credentials = False
137+
...
138+
```
139+
140+
The `hello`, `ignoare_js` and `simple11_dir` are traits defined on the SimpleApp11 class.
141+
142+
It also implements additional flags and aliases for these traits.
143+
144+
+ The `--hello` flag will log on startup `Hello Simple11 - You have provided the --hello flag or defined a c.SimpleApp1.hello == True`.
145+
+ The `--simple11-dir` alias will set `SimpleExt11.simple11_dir` settings.
108146

109147
Stop any running server and then start the simple-ext11.
110148

examples/simple/simple_ext1/application.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ def get_conf(self, key):
5151
return self.settings.get('config').get('SimpleApp1').get(key, None)
5252

5353
def initialize_settings(self):
54-
self.settings.get('config').get('SimpleApp1').update({'app': 'OK'})
5554
self.log.info('SimpleApp1.app {}'.format(self.get_conf('app')))
5655
self.log.info('SimpleApp1.file {}'.format(self.get_conf('file')))
5756
self.log.info('SimpleApp1.cli {}'.format(self.get_conf('cli')))
5857
self.log.info('Complete Settings {}'.format(self.settings))
5958
# TODO Check this setting/config handling... Updating does not look to be fine here...
60-
self.settings["{}_config".format(self.extension_name)].update(**self.settings.get('config').get('SimpleApp1'))
59+
# self.settings.get('config').get(self.extension_name).update({'app': 'OK'})
60+
# self.settings["{}_config".format(self.extension_name)].update(**self.settings.get('config').get('SimpleApp1'))
6161

6262
#-----------------------------------------------------------------------------
6363
# Main entry point

0 commit comments

Comments
 (0)