This file is indexed.

/usr/share/pyshared/MoinMoin/error.py is in python-moinmoin 1.9.3-1ubuntu2.3.

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
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# -*- coding: iso-8859-1 -*-
""" MoinMoin errors

    Supply Error class and sub classes used to raise various errors

    @copyright: 2004-2005 Nir Soffer <nirs@freeshell.org>
    @license: GNU GPL, see COPYING for details.
"""

import sys

from MoinMoin import config

class Error(Exception):
    """ Base class for moin moin errors

    Use this class when you raise errors or create sub classes that
    may be used to display non ASCII error message.

    Standard errors work safely only with strings using ascii or
    unicode. This class can be used safely with both strings using
    config.charset and unicode.

    You can init this class with either unicode or string using
    config.charset encoding. On output, the class will convert the string
    to unicode or the unicode to string, using config.charset.

    When you want to render an error, use unicode() or str() as needed.
    """

    def __init__(self, message):
        """ Initialize an error, decode if needed

        @param message: unicode, str or object that support __unicode__
            and __str__. __str__ should use config.charset.
        """
        self.message = message

    def __unicode__(self):
        """ Return unicode error message """
        if isinstance(self.message, str):
            return unicode(self.message, config.charset)
        else:
            return unicode(self.message)

    def __str__(self):
        """ Return encoded message """
        if isinstance(self.message, unicode):
            return self.message.encode(config.charset)
        else:
            return str(self.message)

    def __getitem__(self, item):
        """ Make it possible to access attributes like a dict """
        return getattr(self, item)


class CompositeError(Error):
    """ Base class for exceptions containing an exception

    Do not use this class but its more specific sub classes.

    Useful for hiding low level error inside high level user error,
    while keeping the inner error information for debugging.

    Example::

        class InternalError(CompositeError):
            ''' Raise for internal errors '''

        try:
            # code that might fail...
        except HairyLowLevelError:
            raise InternalError("Sorry, internal error occurred")

    When showing a traceback, both InternalError traceback and
    HairyLowLevelError traceback are available.
    """

    def __init__(self, message):
        """ Save system exception info before this exception is raised """
        Error.__init__(self, message)
        self.innerException = sys.exc_info()

    def exceptions(self):
        """ Return a list of all inner exceptions """
        all = [self.innerException]
        while 1:
            lastException = all[-1][1]
            try:
                all.append(lastException.innerException)
            except AttributeError:
                break
        return all

class FatalError(CompositeError):
    """ Base class for fatal error we can't handle

    Do not use this class but its more specific sub classes.
    """

class ConfigurationError(FatalError):
    """ Raise when fatal misconfiguration is found """

class InternalError(FatalError):
    """ Raise when internal fatal error is found """

class NoConfigMatchedError(Exception):
    """ we didn't find a configuration for this URL """
    pass

class ConvertError(FatalError):
    """ Raise when html to storage format (e.g. 'wiki') conversion fails """
    name = "MoinMoin Convert Error"