瀏覽代碼

Documentation on the lodel.plugins.dummy package

Roland Haroutiounian 7 年之前
父節點
當前提交
567c677dd9
共有 3 個檔案被更改,包括 26 行新增4 行删除
  1. 11
    2
      lodel/plugins/dummy/__init__.py
  2. 3
    0
      lodel/plugins/dummy/confspec.py
  3. 12
    2
      lodel/plugins/dummy/main.py

+ 11
- 2
lodel/plugins/dummy/__init__.py 查看文件

1
+## @package lodel.plugins.dummy Basic plugin used as a template for developping new plugins
2
+
1
 from lodel.context import LodelContext
3
 from lodel.context import LodelContext
2
 LodelContext.expose_modules(globals(), {
4
 LodelContext.expose_modules(globals(), {
3
     'lodel.validator.validator': ['Validator']})
5
     'lodel.validator.validator': ['Validator']})
4
 
6
 
7
+## @brief plugin's name (matching the package's name)
5
 __plugin_name__ = "dummy"
8
 __plugin_name__ = "dummy"
9
+## @brief plugin's version
6
 __version__ = '0.0.1' #or __version__ = [0,0,1]
10
 __version__ = '0.0.1' #or __version__ = [0,0,1]
11
+## @brief plugin's loader module
7
 __loader__ = "main.py"
12
 __loader__ = "main.py"
13
+## @brief plugin's options' definition module
8
 __confspec__ = "confspec.py"
14
 __confspec__ = "confspec.py"
15
+## @brief plugin's author(s)
9
 __author__ = "Lodel2 dev team"
16
 __author__ = "Lodel2 dev team"
17
+## @brief plugin's full name
10
 __fullname__ = "Dummy plugin"
18
 __fullname__ = "Dummy plugin"
11
 __name__ = 'dummy'
19
 __name__ = 'dummy'
20
+## @brief plugin's category
12
 __plugin_type__ = 'extension'
21
 __plugin_type__ = 'extension'
13
 
22
 
14
 
23
 
15
-##@brief This methods allow plugin writter to write some checks
24
+## @brief This methods allow plugin writter to write some checks
16
 #
25
 #
17
-#@return True if checks are OK else return a string with a reason
26
+# @return bool : True if checks are OK else return a string with a reason
18
 def _activate():
27
 def _activate():
19
     import leapi_dyncode
28
     import leapi_dyncode
20
     print("Testing dynamic objects : ")
29
     print("Testing dynamic objects : ")

+ 3
- 0
lodel/plugins/dummy/confspec.py 查看文件

1
 #-*- coding: utf-8 -*-
1
 #-*- coding: utf-8 -*-
2
 
2
 
3
+## @package lodel.plugins.dummy.confspec The module that defines the plugin's configuration options
4
+
3
 from lodel.context import LodelContext
5
 from lodel.context import LodelContext
4
 LodelContext.expose_modules(globals(), {
6
 LodelContext.expose_modules(globals(), {
5
     'lodel.validator.validator': ['Validator']})
7
     'lodel.validator.validator': ['Validator']})
6
 
8
 
9
+## @brief Dictionary defining the plugin's configuration options and their validators
7
 CONFSPEC = {
10
 CONFSPEC = {
8
     'lodel2.section1': {
11
     'lodel2.section1': {
9
         'key1': (   None,
12
         'key1': (   None,

+ 12
- 2
lodel/plugins/dummy/main.py 查看文件

1
 #-*- coding: utf-8 -*-
1
 #-*- coding: utf-8 -*-
2
 
2
 
3
+## @package lodel.plugins.dummy.main Plugin's loader module
4
+
3
 from lodel.context import LodelContext
5
 from lodel.context import LodelContext
4
 LodelContext.expose_modules(globals(), {
6
 LodelContext.expose_modules(globals(), {
5
     'lodel.plugin': ['LodelHook', 'CustomMethod'],
7
     'lodel.plugin': ['LodelHook', 'CustomMethod'],
6
     'lodel.settings' : 'settings'})
8
     'lodel.settings' : 'settings'})
7
 
9
 
10
+
11
+## @brief callback method using lodel's hook system
12
+# @param hook_name str
13
+# @param caller function : action to perform
14
+# @param payload : data to pass to the caller
15
+# @return payload
8
 @LodelHook('leapi_get_post')
16
 @LodelHook('leapi_get_post')
9
 @LodelHook('leapi_update_pre')
17
 @LodelHook('leapi_update_pre')
10
 @LodelHook('leapi_update_post')
18
 @LodelHook('leapi_update_post')
17
         print("\tHook %s\tcaller %s with %s" % (hook_name, caller, payload))
25
         print("\tHook %s\tcaller %s with %s" % (hook_name, caller, payload))
18
     return payload
26
     return payload
19
 
27
 
20
-
28
+## @brief instance method
29
+# This is an example of a basic plugin's custom method
21
 @CustomMethod('Object', 'dummy_method')
30
 @CustomMethod('Object', 'dummy_method')
22
 def dummy_instance_method(self):
31
 def dummy_instance_method(self):
23
     print("Hello world !\
32
     print("Hello world !\
24
 I'm a custom method on an instance of class %s" % self.__class__)
33
 I'm a custom method on an instance of class %s" % self.__class__)
25
 
34
 
26
 
35
 
36
+## @brief instance method
37
+# This is an example of a basic plugin's custom method
27
 @CustomMethod('Object', 'dummy_class_method', CustomMethod.CLASS_METHOD)
38
 @CustomMethod('Object', 'dummy_class_method', CustomMethod.CLASS_METHOD)
28
 def dummy_instance_method(self):
39
 def dummy_instance_method(self):
29
     print("Hello world !\
40
     print("Hello world !\
30
 I'm a custom method on class %s" % self.__class__)
41
 I'm a custom method on class %s" % self.__class__)
31
-

Loading…
取消
儲存