server/__init__.py
branchstable
changeset 7080 a828feedc164
parent 7061 bb2080547722
child 7094 4f9f13a50484
equal deleted inserted replaced
7075:4751d77394b1 7080:a828feedc164
    60             DEBUG |= globals()[mode]
    60             DEBUG |= globals()[mode]
    61     else:
    61     else:
    62         DEBUG |= debugmode
    62         DEBUG |= debugmode
    63 
    63 
    64 class debugged(object):
    64 class debugged(object):
    65     """repository debugging context manager / decorator
    65     """Context manager and decorator to help debug the repository.
    66 
    66 
    67     Can be used either as a context manager:
    67     It can be used either as a context manager:
    68 
    68 
    69     >>> with debugged(server.DBG_RQL | server.DBG_REPO):
    69     >>> with debugged(server.DBG_RQL | server.DBG_REPO):
    70     ...     # some code in which you want to debug repository activity,
    70     ...     # some code in which you want to debug repository activity,
    71     ...     # seing information about RQL being executed an repository events.
    71     ...     # seing information about RQL being executed an repository events.
    72 
    72 
    75     >>> @debugged(server.DBG_RQL | server.DBG_REPO)
    75     >>> @debugged(server.DBG_RQL | server.DBG_REPO)
    76     ... def some_function():
    76     ... def some_function():
    77     ...     # some code in which you want to debug repository activity,
    77     ...     # some code in which you want to debug repository activity,
    78     ...     # seing information about RQL being executed an repository events
    78     ...     # seing information about RQL being executed an repository events
    79 
    79 
    80     debug mode will be reseted at its original value when leaving the "with"
    80     The debug mode will be reset to its original value when leaving the "with"
    81     block or the decorated function
    81     block or the decorated function.
    82     """
    82     """
    83     def __init__(self, debugmode):
    83     def __init__(self, debugmode):
    84         self.debugmode = debugmode
    84         self.debugmode = debugmode
    85         self._clevel = None
    85         self._clevel = None
    86 
    86