Allow to bypass m18n if a raw message is given

This commit is contained in:
Alexandre Aubin 2018-12-12 19:36:43 +00:00
parent a58d4dbb87
commit df7ee42254

View file

@ -412,8 +412,11 @@ def clean_session(session_id, profiles=[]):
class MoulinetteError(StandardError): class MoulinetteError(StandardError):
"""Moulinette base exception""" """Moulinette base exception"""
def __init__(self, key, *args, **kwargs): def __init__(self, key, __raw_msg__=False, *args, **kwargs):
msg = moulinette.m18n.g(key, *args, **kwargs) if __raw_msg__:
msg = key
else:
msg = moulinette.m18n.g(key, *args, **kwargs)
super(MoulinetteError, self).__init__(msg) super(MoulinetteError, self).__init__(msg)
self.strerror = msg self.strerror = msg