Mercurial > libervia-backend
diff sat/tools/utils.py @ 2793:181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 25 Jan 2019 09:06:29 +0100 |
parents | 003b8b4b56a7 |
children | ab2696e34d29 |
line wrap: on
line diff
--- a/sat/tools/utils.py Tue Jan 22 18:52:16 2019 +0100 +++ b/sat/tools/utils.py Fri Jan 25 09:06:29 2019 +0100 @@ -21,12 +21,7 @@ import unicodedata import os.path -from sat.core.constants import Const as C -from sat.core.log import getLogger - -log = getLogger(__name__) import datetime -from twisted.python import procutils import subprocess import time import sys @@ -34,6 +29,11 @@ import inspect import textwrap import functools +from twisted.python import procutils +from sat.core.constants import Const as C +from sat.core.log import getLogger + +log = getLogger(__name__) NO_REPOS_DATA = u"repository data unknown" @@ -56,6 +56,12 @@ return "".join(valid_chars(ustr)) +def logError(failure_): + """Genertic errback which log the error as a warning, and re-raise it""" + log.warning(failure_.value) + raise failure_ + + def partial(func, *fixed_args, **fixed_kwargs): # FIXME: temporary hack to workaround the fact that inspect.getargspec is not working with functools.partial # making partial unusable with current D-bus module (in addMethod).