1
0
Fork 0
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:
Yann 2016-05-18 16:12:40 +02:00
commit c7b583d416
9 changed files with 55 additions and 5 deletions

View file

@ -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:

View file

@ -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()'

View file

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

View file

@ -0,0 +1,4 @@
[lodel2.webui.sessions]
directory=./sessions
expiration=900
file_template=lodel2_%s.sess

View file

14
plugins/webui/confspec.py Normal file
View 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
View 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

View file

@ -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"