1 # -*- coding: utf-8 -*-
2 # copyright 2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
3 # contact http://www.logilab.fr -- mailto:contact@logilab.fr
5 # This program is free software: you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation, either version 2.1 of the License, or (at your option)
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 # You should have received a copy of the GNU Lesser General Public License along
16 # with this program. If not, see <http://www.gnu.org/licenses/>.
18 Creates the ``EficasException`` class for the EDF Eficas application.
19 This class supports the internationalization mechanism provided in
23 from __future__ import absolute_import
24 class EficasException(Exception):
26 ``EficasException`` class, which embeds the translation mechanism.
27 In case the input message is already passed through the translation
28 mechanism, the translation mechanism defined in this class would
29 have no effect, since its input would not be among the source
30 strings to be translated.
32 def __init__(self, msg=""):
34 Initializes the EficasException instances. The output message,
35 stored in the ``args`` attribute, is fitted with the translation
38 Exception.__init__(self)
40 #sys.path.append(os.path.realpath(".."))
41 from Extensions.i18n import tr
42 self.args = (tr(msg),)
45 if __name__ == "__main__":
47 raise EficasException(sys.argv[1])