mirror of
https://github.com/yweber/lodel2.git
synced 2025-12-03 17:26:54 +01:00
New webui plugin + create_instance.sh update
- create_instance.sh create some symbolic links - webui plugin that add webui configuration variable
This commit is contained in:
parent
85d11c0376
commit
c7b583d416
9 changed files with 55 additions and 5 deletions
5
Makefile
5
Makefile
|
|
@ -1,3 +1,4 @@
|
|||
python=python3
|
||||
dyncode_filename='lodel/leapi/dyncode.py'
|
||||
|
||||
all: tests doc dyncode
|
||||
|
|
@ -11,11 +12,11 @@ doc_graphviz:
|
|||
|
||||
# Test em update ( examples/em_test.pickle )
|
||||
em_test:
|
||||
python3 em_test.py
|
||||
$(python) em_test.py
|
||||
|
||||
# generate leapi dynamic code
|
||||
dyncode: clean_dyn em_test
|
||||
python3 scripts/refreshdyn.py examples/em_test.pickle $(dyncode_filename) && echo -e "\n\nCode generated in $(dyncode_filename)"
|
||||
$(python) scripts/refreshdyn.py examples/em_test.pickle $(dyncode_filename) && echo -e "\n\nCode generated in $(dyncode_filename)"
|
||||
|
||||
# run tests
|
||||
tests:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
python=python3
|
||||
|
||||
all: dyncode
|
||||
|
||||
dyncode:
|
||||
python -c 'import lodel_admin; lodel_admin.refresh_dyncode()'
|
||||
$(python) -c 'import lodel_admin; lodel_admin.refresh_dyncode()'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
[lodel2]
|
||||
debug = False
|
||||
plugins = dummy
|
||||
sitename = noname
|
||||
plugins_path = /foo/plugins
|
||||
plugins = dummy, webui
|
||||
|
||||
[lodel2.logging.stderr]
|
||||
level = DEBUG
|
||||
|
|
|
|||
4
install/conf.d/webui_plugin.ini
Normal file
4
install/conf.d/webui_plugin.ini
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[lodel2.webui.sessions]
|
||||
directory=./sessions
|
||||
expiration=900
|
||||
file_template=lodel2_%s.sess
|
||||
0
plugins/webui/__init__.py
Normal file
0
plugins/webui/__init__.py
Normal file
14
plugins/webui/confspec.py
Normal file
14
plugins/webui/confspec.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#-*- coding: utf-8 -*-
|
||||
|
||||
from lodel.settings.validator import SettingValidator
|
||||
|
||||
CONFSPEC = {
|
||||
'lodel2.webui.sessions': {
|
||||
'directory': ( '/tmp/lodel2_session',
|
||||
SettingValidator('path')),
|
||||
'expiration': ( 900,
|
||||
SettingValidator('int')),
|
||||
'file_template': ( 'lodel2_%s.sess',
|
||||
SettingValidator('dummy')),
|
||||
}
|
||||
}
|
||||
17
plugins/webui/main.py
Normal file
17
plugins/webui/main.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#-*- coding: utf-8 -*-
|
||||
|
||||
from lodel.plugin import LodelHook
|
||||
|
||||
##@brief Hook's callback example
|
||||
@LodelHook('leapi_get_pre')
|
||||
@LodelHook('leapi_get_post')
|
||||
@LodelHook('leapi_update_pre')
|
||||
@LodelHook('leapi_update_post')
|
||||
@LodelHook('leapi_delete_pre')
|
||||
@LodelHook('leapi_delete_post')
|
||||
@LodelHook('leapi_insert_pre')
|
||||
@LodelHook('leapi_insert_post')
|
||||
def dummy_callback(hook_name, caller, payload):
|
||||
if Lodel.settings.Settings.debug:
|
||||
print("\tHook %s\tcaller %s with %s" % (hook_name, caller, payload))
|
||||
return payload
|
||||
|
|
@ -29,8 +29,19 @@ fi
|
|||
|
||||
echo "Creating lodel instance directory '$instdir'"
|
||||
mkdir -pv "$instdir"
|
||||
mkdir -pv "$instdir/sessions"
|
||||
chmod 700 "$instdir/sessions"
|
||||
|
||||
#cp -Rv $libdir/install/* $instdir
|
||||
cp -Rv $libdir/install/conf.d $instdir/
|
||||
cp -Rv $libdir/install/loader.py $instdir/
|
||||
cp -Rv $libdir/install/editorial_model.pickle $instdir/
|
||||
ln -s $libdir/install/Makefile $instdir/Makefile
|
||||
ln -s $libdir/install/run.py $instdir/run.py
|
||||
ln -s $libdir/install/lodel_admin.py $instdir/lodel_admin.py
|
||||
ln -s $libdir/plugins $instdir/plugins
|
||||
|
||||
|
||||
cp -Rv $libdir/install/* $instdir
|
||||
|
||||
# Adding lib path to loader
|
||||
sed -i -E "s#^(LODEL2_LIB_ABS_PATH = )None#\1'$libdir'#" "$loader"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue