1
1
import os
2
2
from simple_ext1 .application import SimpleApp1
3
+ from jupyter_server .serverapp import aliases , flags
3
4
4
5
DEFAULT_STATIC_FILES_PATH = os .path .join (os .path .dirname (__file__ ), "./../simple_ext1/static" )
5
6
DEFAULT_TEMPLATE_FILES_PATH = os .path .join (os .path .dirname (__file__ ), "./../simple_ext1/templates" )
6
7
7
8
class SimpleApp11 (SimpleApp1 ):
9
+ flags ['hello' ]= (
10
+ {'SimpleApp11' : {'hello' : True }},
11
+ "Say hello on startup."
12
+ )
13
+ aliases .update ({
14
+ 'notebook-dir' : 'ServerApp.notebook_dir' ,
15
+ })
8
16
9
17
# The name of the extension.
10
18
extension_name = "simple_ext11"
@@ -19,14 +27,16 @@ class SimpleApp11(SimpleApp1):
19
27
DEFAULT_TEMPLATE_FILES_PATH
20
28
]
21
29
22
- def initialize_handlers (self ):
23
- super (). initialize_handlers ( )
24
-
25
- def initialize_templates ( self ):
26
- super (). initialize_templates ()
30
+ def get_conf (self , key ):
31
+ simple_app_11 = self . settings . get ( 'config' ). get ( 'SimpleApp11' )
32
+ if simple_app_11 :
33
+ return simple_app_11 . get ( key , None )
34
+ return None
27
35
28
36
def initialize_settings (self ):
29
- super ().initialize_templates ()
37
+ if self .get_conf ('hello' ) == True :
38
+ self .log .info ('Hello Simple11 - You have provided the --hello flag or defined a c.SimpleApp1.hello == True' )
39
+ super ().initialize_settings ()
30
40
31
41
#-----------------------------------------------------------------------------
32
42
# Main entry point
0 commit comments