This file is indexed.

/usr/lib/python2.7/dist-packages/jabberbot/i18n.py is in python-moinmoin 1.9.8-1ubuntu1.

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
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - jabber bot i18n routines

    @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
    @license: GNU GPL, see COPYING for details.
"""
import logging, xmlrpclib
from jabberbot.config import BotConfig

TRANSLATIONS = None


def get_text(original, lang="en"):
    """ Return a translation of text in the user's language.

        @type original: unicode
    """
    if original == u"":
        return u""

    global TRANSLATIONS
    if not TRANSLATIONS:
        init_i18n(BotConfig)

    try:
        return TRANSLATIONS[lang][original]
    except KeyError:
        return original


def init_i18n(config):
    """Prepare i18n

    @type config: jabberbot.config.BotConfig

    """
    global TRANSLATIONS
    TRANSLATIONS = request_translations(config) or {'en': {}}


def request_translations(config):
    """Download translations from wiki using xml rpc

    @type config: jabberbot.config.BotConfig

    """

    wiki = xmlrpclib.Server(config.wiki_url + "?action=xmlrpc2")
    log = logging.getLogger(__name__)
    log.debug("Initialising i18n...")

    try:
        translations =  wiki.getBotTranslations()
        return translations
    except xmlrpclib.Fault, fault:
        log.error("XML RPC fault occurred while getting translations: %s" % (str(fault), ))
    except xmlrpclib.Error, error:
        log.error("XML RPC error occurred while getting translations: %s" % (str(error), ))
    except Exception, exc:
        log.error("Unexpected exception occurred while getting translations: %s" % (str(exc), ))

    log.error("Translations could not be downloaded, is wiki is accesible?")
    return None