This file is indexed.

/usr/lib/python2.7/dist-packages/restkit/contrib/webob_helper.py is in python-restkit 4.2.2-2.

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
# -*- coding: utf-8 -
#
# This file is part of restkit released under the MIT license. 
# See the NOTICE for more information.


import webob.exc

from restkit import errors

class WebobResourceError(webob.exc.WSGIHTTPException):
    """
    Wrapper to return webob exceptions instead of restkit errors. Usefull
    for those who want to build `WSGI <http://wsgi.org/wsgi/>`_ applications
    speaking directly to others via HTTP.
    
    To do it place somewhere in your application the function 
    `wrap_exceptions`::
    
        wrap_exceptions()

    It will automatically replace restkit errors by webob exceptions.
    """

    def __init__(self, msg=None, http_code=None, response=None):
        webob.exc.WSGIHTTPException.__init__(self)
        
        http_code = http_code or 500
        klass = webob.exc.status_map[http_code]
        self.code = http_code
        self.title = klass.title
        self.status = '%s %s' % (self.code, self.title)
        self.explanation = msg
        self.response = response
        # default params
        self.msg = msg

    def _status_int__get(self):
        """
        The status as an integer
        """
        return int(self.status.split()[0])
    def _status_int__set(self, value):
        self.status = value
    status_int = property(_status_int__get, _status_int__set, 
        doc=_status_int__get.__doc__)

    def _get_message(self):
        return self.explanation
    def _set_message(self, msg):
        self.explanation = msg or ''
    message = property(_get_message, _set_message)

webob_exceptions = False
def wrap_exceptions():
    """ wrap restkit exception to return WebBob exceptions"""
    global webob_exceptions
    if webob_exceptions: return
    errors.ResourceError = WebobResourceError
    webob_exceptions = True