This file is indexed.

/usr/lib/python2.7/dist-packages/odoorpc/error.py is in python-odoorpc 0.4.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# -*- coding: UTF-8 -*-
##############################################################################
#
#    OdooRPC
#    Copyright (C) 2014 Sébastien Alix.
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Lesser General Public License as published
#    by the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
"""This module contains all exceptions raised by `OdooRPC` when an error
occurred.
"""


class Error(Exception):
    """Base class for exception."""
    pass


class RPCError(Error):
    """Exception raised for errors related to RPC queries.
    Error details (like the `Odoo` server traceback) are available through the
    `info` attribute:

    .. doctest::
        :options: +SKIP

        >>> from pprint import pprint as pp
        >>> try:
        ...     odoo.execute('res.users', 'wrong_method')
        ... except odoorpc.error.RPCError as exc:
        ...     pp(exc.info)
        ...
        {'code': 200,
         'data': {'arguments': ["'res.users' object has no attribute 'wrong_method'"],
                  'debug': 'Traceback (most recent call last):\\n  File ...',
                  'message': "'res.users' object has no attribute 'wrong_method'",
                  'name': 'exceptions.AttributeError'}
         'message': 'OpenERP Server Error'}

    .. doctest::
        :hide:

        >>> from pprint import pprint as pp
        >>> try:
        ...     odoo.execute('res.users', 'wrong_method')
        ... except odoorpc.error.RPCError as exc:
        ...     exc.info['code'] == 200
        ...     'message' in exc.info
        ...     exc.info['data']['arguments'] == ["'res.users' object has no attribute 'wrong_method'"]
        ...     exc.info['data']['debug'].startswith('Traceback (most recent call last):\\n  File')
        ...     exc.info['data']['message'] == "'res.users' object has no attribute 'wrong_method'"
        ...     exc.info['data']['name'] == 'exceptions.AttributeError'
        ...
        True
        True
        True
        True
        True
        True
    """
    def __init__(self, message, info=False):
        super(Error, self).__init__(message, info)
        self.info = info

    def __str__(self):
        return self.args and self.args[0] or ''

    def __repr__(self):
        return "%s(%s)" % (
            self.__class__.__name__,
            repr(self.args[0]))


class InternalError(Error):
    """Exception raised for errors occurring during an internal operation."""
    pass

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: