Przeglądaj źródła

Small changes in webui plugin and loader.py

- webui now calls a hook to indicate a session end
- loader.py now set a lodel.dyncode module exposing dynmically generated code
Yann Weber 8 lat temu
rodzic
commit
904d14cae7

+ 3
- 0
install/loader.py Wyświetl plik

@@ -53,6 +53,9 @@ if __name__ == '__main__':
53 53
         runner.run(suite)
54 54
         exit()
55 55
 
56
+    import lodel
57
+    import leapi_dyncode as dyncode
58
+    lodel.dyncode = dyncode
56 59
     LodelHook.call_hook('lodel2_loader_main', '__main__', None)
57 60
 
58 61
     #Run interative python

+ 2
- 0
lodel/__init__.py Wyświetl plik

@@ -1,5 +1,7 @@
1 1
 #-*- coding: utf-8 -*-
2 2
 
3
+dyncode = None
4
+
3 5
 ##@page lodel2_start Lodel2 boot mechanism
4 6
 #
5 7
 # @par Lodel2 boot sequence

+ 3
- 0
lodel/leapi/datahandlers/datas.py Wyświetl plik

@@ -111,3 +111,6 @@ class Concat(FormatString):
111 111
         super().__init__(
112 112
             format_string = format_string, field_list = field_list, **kwargs)
113 113
 
114
+class Password(Varchar):
115
+    help = 'Handle passwords'
116
+    pass

+ 0
- 3
plugins/mongodb_datasource/datasource.py Wyświetl plik

@@ -215,9 +215,6 @@ class MongoDbDatasource(object):
215 215
         mongo_filters = self.__process_filters(
216 216
             target, filters, relational_filters)
217 217
         res = self.__collection(target).update(mongo_filters, upd_datas)
218
-        logger.warning(mongo_filters)
219
-        logger.warning(upd_datas)
220
-        logger.warning(res)
221 218
         return res['n']
222 219
 
223 220
     ## @brief Inserts a record in a given collection

+ 3
- 0
plugins/webui/main.py Wyświetl plik

@@ -15,6 +15,9 @@ def root_url():
15 15
 ##@brief uwsgi startup demo
16 16
 @LodelHook('lodel2_loader_main')
17 17
 def uwsgi_fork(hook_name, caller, payload):
18
+    from lodel.plugin.plugins import Plugin
19
+    Plugin.from_name('users')
20
+
18 21
     if Settings.webui.standalone:
19 22
         cmd='{uwsgi} --http-socket {addr}:{port} --module plugins.webui.run'
20 23
         cmd = cmd.format(

+ 5
- 2
plugins/webui/run.py Wyświetl plik

@@ -10,6 +10,7 @@ from .interface.router import get_controller
10 10
 from .interface.lodelrequest import LodelRequest
11 11
 from .exceptions import *
12 12
 from lodel.utils.datetime import get_utc_timestamp
13
+from lodel.plugin.hooks import LodelHook
13 14
 
14 15
 SESSION_FILES_BASE_DIR = Settings.webui.sessions.directory
15 16
 SESSION_FILES_TEMPLATE = Settings.webui.sessions.file_template
@@ -73,5 +74,7 @@ def application(env, start_response):
73 74
     if request.session.should_save:
74 75
         session_store.save(request.session)
75 76
         response.set_cookie('sid', request.session.sid)
76
-
77
-    return response(env, start_response)
77
+    
78
+    res = response(env, start_response)
79
+    LodelHook.call_hook('lodel2_session_end', __file__, None)
80
+    return res

Loading…
Anuluj
Zapisz