Переглянути джерело

Added documentation on the lodel/auth/exceptions.py module

Roland Haroutiounian 7 роки тому
джерело
коміт
5d43f04276
1 змінених файлів з 28 додано та 11 видалено
  1. 28
    11
      lodel/auth/exceptions.py

+ 28
- 11
lodel/auth/exceptions.py Переглянути файл

@@ -1,24 +1,30 @@
1
+# @package lodel.auth.exceptions
2
+# @brief Defines the specific exceptions used in the authentication process
3
+
1 4
 from lodel.context import LodelContext
2 5
 
3 6
 LodelContext.expose_modules(globals(), {
4 7
     'lodel.logger': 'logger',
5 8
     'lodel.plugin.hooks': ['LodelHook']})
6 9
 
7
-##@brief Handles common errors with a Client
10
+
11
+## @brief Handles common errors with a Client
8 12
 class ClientError(Exception):
9
-    ##@brief The logger function to use to log the error message
13
+    ## @brief The logger function to use to log the error message
10 14
     _loglvl = 'warning'
11
-    ##@brief Error str
15
+    ## @brief Error string
12 16
     _err_str = "Error"
13
-    ##@brief the hook name to trigger with error
17
+    ## @brief the hook name to trigger with error
14 18
     _action = 'lodel2_ui_error'
15
-    ##@brief the hook payload
19
+    ## @brief the hook payload
16 20
     _payload = None
17 21
 
18
-    ##@brief Constructor
22
+    ## @brief Constructor
19 23
     #
20
-    #Log message are build using the following format :
21
-    #"<client infos> : <_err_str>[ : <msg>]"
24
+    # Log messages are built using the following format :
25
+    # "<client infos> : <_err_str>[ : <msg>]"
26
+    # @param client Client : object containing the client's data
27
+    # @param msg str : message string to use
22 28
     def __init__(self, client, msg = ""):
23 29
         msg = self.build_message(client, msg)
24 30
         if self._loglvl is not None:
@@ -28,30 +34,41 @@ class ClientError(Exception):
28 34
         if self._action is not None:
29 35
             LodelHook.call_hook(self._action, self, self._payload)
30 36
 
31
-    ##@brief build error message
37
+    ## @brief Builds an error message
38
+    # @param client Client
39
+    # @param msg str
32 40
     def build_message(self, client, msg):
33 41
         res = "%s : %s" % (client, self._err_str)
34 42
         if len(msg) > 0:
35 43
             res += " : %s" % msg
36 44
         return res
37 45
 
38
-##@brief Handles authentication failure errors
46
+
47
+## @brief Handles authentication failure errors
39 48
 class ClientAuthenticationFailure(ClientError):
49
+    ## @brief Log Level
40 50
     _loglvl = 'security'
51
+    ## @brief Error string
41 52
     _err_str = 'Authentication failure'
53
+    ## @brief Hook to trigger
42 54
     _action = 'lodel2_ui_authentication_failure'
43 55
 
44 56
 
45 57
 ##@brief Handles permission denied errors
46 58
 class ClientPermissionDenied(ClientError):
59
+    ## @brief Log level
47 60
     _loglvl = 'security'
61
+    ## @brief Error string
48 62
     _err_str = 'Permission denied'
63
+    ## @brief Hook to trigger
49 64
     _action = 'lodel2_ui_permission_denied'
50 65
     
51 66
 
52 67
 ##@brief Handles common errors on authentication
53 68
 class ClientAuthenticationError(ClientError):
69
+    ## @brief Log level
54 70
     _loglvl = 'error'
71
+    ## @brief Error string
55 72
     _err_str = 'Authentication error'
73
+    ## @brief Hook to trigger
56 74
     _action = 'lodel2_ui_error'
57
-

Loading…
Відмінити
Зберегти