Browse Source

New webui plugin + create_instance.sh update

- create_instance.sh create some symbolic links
- webui plugin that add webui configuration variable
Yann Weber 8 years ago
parent
commit
c7b583d416

+ 3
- 2
Makefile View File

1
+python=python3
1
 dyncode_filename='lodel/leapi/dyncode.py'
2
 dyncode_filename='lodel/leapi/dyncode.py'
2
 
3
 
3
 all: tests doc dyncode
4
 all: tests doc dyncode
11
 
12
 
12
 # Test em update ( examples/em_test.pickle )
13
 # Test em update ( examples/em_test.pickle )
13
 em_test:
14
 em_test:
14
-	python3 em_test.py
15
+	$(python) em_test.py
15
 
16
 
16
 # generate leapi dynamic code
17
 # generate leapi dynamic code
17
 dyncode: clean_dyn em_test
18
 dyncode: clean_dyn em_test
18
-	python3 scripts/refreshdyn.py examples/em_test.pickle $(dyncode_filename) && echo -e "\n\nCode generated in $(dyncode_filename)"
19
+	$(python) scripts/refreshdyn.py examples/em_test.pickle $(dyncode_filename) && echo -e "\n\nCode generated in $(dyncode_filename)"
19
 
20
 
20
 # run tests
21
 # run tests
21
 tests:
22
 tests:

+ 3
- 1
install/Makefile View File

1
+python=python3
2
+
1
 all: dyncode
3
 all: dyncode
2
 
4
 
3
 dyncode:
5
 dyncode:
4
-	python -c 'import lodel_admin; lodel_admin.refresh_dyncode()'
6
+	$(python) -c 'import lodel_admin; lodel_admin.refresh_dyncode()'

+ 2
- 1
install/conf.d/lodel2.ini View File

1
 [lodel2]
1
 [lodel2]
2
 debug = False
2
 debug = False
3
-plugins = dummy
4
 sitename = noname
3
 sitename = noname
4
+plugins_path = /foo/plugins
5
+plugins = dummy, webui
5
 
6
 
6
 [lodel2.logging.stderr]
7
 [lodel2.logging.stderr]
7
 level = DEBUG
8
 level = DEBUG

+ 4
- 0
install/conf.d/webui_plugin.ini View File

1
+[lodel2.webui.sessions]
2
+directory=./sessions
3
+expiration=900
4
+file_template=lodel2_%s.sess

run.py → install/run.py View File


+ 0
- 0
plugins/webui/__init__.py View File


+ 14
- 0
plugins/webui/confspec.py View File

1
+#-*- coding: utf-8 -*-
2
+
3
+from lodel.settings.validator import SettingValidator
4
+
5
+CONFSPEC = {
6
+    'lodel2.webui.sessions': {
7
+        'directory': (  '/tmp/lodel2_session',
8
+                        SettingValidator('path')),
9
+        'expiration': ( 900,
10
+                        SettingValidator('int')),
11
+        'file_template': (  'lodel2_%s.sess',
12
+                            SettingValidator('dummy')),
13
+    }
14
+}

+ 17
- 0
plugins/webui/main.py View File

1
+#-*- coding: utf-8 -*-
2
+
3
+from lodel.plugin import LodelHook
4
+
5
+##@brief Hook's callback example
6
+@LodelHook('leapi_get_pre')
7
+@LodelHook('leapi_get_post')
8
+@LodelHook('leapi_update_pre')
9
+@LodelHook('leapi_update_post')
10
+@LodelHook('leapi_delete_pre')
11
+@LodelHook('leapi_delete_post')
12
+@LodelHook('leapi_insert_pre')
13
+@LodelHook('leapi_insert_post')
14
+def dummy_callback(hook_name, caller, payload):
15
+    if Lodel.settings.Settings.debug:
16
+        print("\tHook %s\tcaller %s with %s" % (hook_name, caller, payload))
17
+    return payload   

+ 12
- 1
scripts/create_instance.sh View File

29
 
29
 
30
 echo "Creating lodel instance directory '$instdir'"
30
 echo "Creating lodel instance directory '$instdir'"
31
 mkdir -pv "$instdir"
31
 mkdir -pv "$instdir"
32
+mkdir -pv "$instdir/sessions"
33
+chmod 700 "$instdir/sessions"
34
+
35
+#cp -Rv $libdir/install/* $instdir
36
+cp -Rv $libdir/install/conf.d $instdir/
37
+cp -Rv $libdir/install/loader.py $instdir/
38
+cp -Rv $libdir/install/editorial_model.pickle $instdir/
39
+ln -s $libdir/install/Makefile $instdir/Makefile
40
+ln -s $libdir/install/run.py $instdir/run.py
41
+ln -s $libdir/install/lodel_admin.py $instdir/lodel_admin.py
42
+ln -s $libdir/plugins $instdir/plugins
43
+
32
 
44
 
33
-cp -Rv $libdir/install/* $instdir
34
 
45
 
35
 # Adding lib path to loader
46
 # Adding lib path to loader
36
 sed -i -E "s#^(LODEL2_LIB_ABS_PATH = )None#\1'$libdir'#" "$loader"
47
 sed -i -E "s#^(LODEL2_LIB_ABS_PATH = )None#\1'$libdir'#" "$loader"

Loading…
Cancel
Save