Browse Source

Documentation on the lodel.plugins.dummy package

Roland Haroutiounian 7 years ago
parent
commit
567c677dd9
3 changed files with 26 additions and 4 deletions
  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 View File

@@ -1,20 +1,29 @@
1
+## @package lodel.plugins.dummy Basic plugin used as a template for developping new plugins
2
+
1 3
 from lodel.context import LodelContext
2 4
 LodelContext.expose_modules(globals(), {
3 5
     'lodel.validator.validator': ['Validator']})
4 6
 
7
+## @brief plugin's name (matching the package's name)
5 8
 __plugin_name__ = "dummy"
9
+## @brief plugin's version
6 10
 __version__ = '0.0.1' #or __version__ = [0,0,1]
11
+## @brief plugin's loader module
7 12
 __loader__ = "main.py"
13
+## @brief plugin's options' definition module
8 14
 __confspec__ = "confspec.py"
15
+## @brief plugin's author(s)
9 16
 __author__ = "Lodel2 dev team"
17
+## @brief plugin's full name
10 18
 __fullname__ = "Dummy plugin"
11 19
 __name__ = 'dummy'
20
+## @brief plugin's category
12 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 27
 def _activate():
19 28
     import leapi_dyncode
20 29
     print("Testing dynamic objects : ")

+ 3
- 0
lodel/plugins/dummy/confspec.py View File

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

+ 12
- 2
lodel/plugins/dummy/main.py View File

@@ -1,10 +1,18 @@
1 1
 #-*- coding: utf-8 -*-
2 2
 
3
+## @package lodel.plugins.dummy.main Plugin's loader module
4
+
3 5
 from lodel.context import LodelContext
4 6
 LodelContext.expose_modules(globals(), {
5 7
     'lodel.plugin': ['LodelHook', 'CustomMethod'],
6 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 16
 @LodelHook('leapi_get_post')
9 17
 @LodelHook('leapi_update_pre')
10 18
 @LodelHook('leapi_update_post')
@@ -17,15 +25,17 @@ def dummy_callback(hook_name, caller, payload):
17 25
         print("\tHook %s\tcaller %s with %s" % (hook_name, caller, payload))
18 26
     return payload
19 27
 
20
-
28
+## @brief instance method
29
+# This is an example of a basic plugin's custom method
21 30
 @CustomMethod('Object', 'dummy_method')
22 31
 def dummy_instance_method(self):
23 32
     print("Hello world !\
24 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 38
 @CustomMethod('Object', 'dummy_class_method', CustomMethod.CLASS_METHOD)
28 39
 def dummy_instance_method(self):
29 40
     print("Hello world !\
30 41
 I'm a custom method on class %s" % self.__class__)
31
-

Loading…
Cancel
Save