Changes

Jump to navigation Jump to search

Relax source design

532 bytes added, 10:10, 26 September 2014
β†’β€ŽThe check_*() functions: Expanded the implementation section.
=== Implementation ===
Here is a prototype functionfor implementing the check object:
<source lang="python">
"""Check if xxx.
@param a: Some check specific argument. @type a: str @keyword ab: Some check specific keyword argument. @type ab: int
@return: The status of the check and the message to send to the user.
@rtype: bool, str
# Check that...
if not something(a, b):
check_ok = False
</source>
 
In the module where the check is performed, the code would be:
 
<source lang="python">
 
# relax module imports.
from xxx import check_xxx
 
 
def aaa():
"""Some function."""
 
# Checks.
a = '600 MHz'
b = 600
check_xxx(a, b=b, escalate=2)
 
</source>
 
Note that the lib.checks.Check.__call__() method will take the escalate argument for itself and pass 'a' and 'b' into the 'check_xxx_func' function as arguments.
Trusted, Bureaucrats
4,228

edits

Navigation menu