This file is indexed.

/usr/lib/python3/dist-packages/social/strategies/webpy_strategy.py is in python3-social-auth 1:0.2.21+dfsg-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
import web

from social.strategies.base import BaseStrategy, BaseTemplateStrategy


class WebpyTemplateStrategy(BaseTemplateStrategy):
    def render_template(self, tpl, context):
        return web.template.render(tpl)(**context)

    def render_string(self, html, context):
        return web.template.Template(html)(**context)


class WebpyStrategy(BaseStrategy):
    DEFAULT_TEMPLATE_STRATEGY = WebpyTemplateStrategy

    def get_setting(self, name):
        return getattr(web.config, name)

    def request_data(self, merge=True):
        if merge:
            data = web.input(_method='both')
        elif web.ctx.method == 'POST':
            data = web.input(_method='post')
        else:
            data = web.input(_method='get')
        return data

    def request_host(self):
        return web.ctx.host

    def redirect(self, url):
        return web.seeother(url)

    def html(self, content):
        web.header('Content-Type', 'text/html;charset=UTF-8')
        return content

    def render_html(self, tpl=None, html=None, context=None):
        if not tpl and not html:
            raise ValueError('Missing template or html parameters')
        context = context or {}
        if tpl:
            tpl = web.template.frender(tpl)
        else:
            tpl = web.template.Template(html)
        return tpl(**context)

    def session_get(self, name, default=None):
        return web.web_session.get(name, default)

    def session_set(self, name, value):
        web.web_session[name] = value

    def session_pop(self, name):
        return web.web_session.pop(name, None)

    def session_setdefault(self, name, value):
        return web.web_session.setdefault(name, value)

    def build_absolute_uri(self, path=None):
        path = path or ''
        if path.startswith('http://') or path.startswith('https://'):
            return path
        return web.ctx.protocol + '://' + web.ctx.host + path