This file is indexed.

/usr/share/pyshared/albatross/common.py is in python-albatross 1.36-5.5.

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
#
# Copyright 2001 by Object Craft P/L, Melbourne, Australia.
#
# LICENCE - see LICENCE file distributed with this software for details.
#
# Stuff shared by all albatross modules - must not import any other
# albatross modules, or cycles will result.

# Base exception class used by all Albatross exceptions
class AlbatrossError(Exception):
    pass


# Generic causes of exceptions:
class UserError(AlbatrossError):
    pass


class ApplicationError(AlbatrossError):
    pass


class InternalError(AlbatrossError):
    pass


class ServerError(AlbatrossError):
    pass


# Specific exceptions:
class SecurityError(UserError):
    pass


class TemplateLoadError(ApplicationError):
    pass

class SessionExpired(UserError):
    pass

# HTTP/1.0 Status definitions from RFC1945
HTTP_OK                           = 200
HTTP_CREATED                      = 201
HTTP_ACCEPTED                     = 202
HTTP_NO_CONTENT                   = 204
HTTP_MULTIPLE_CHOICES             = 300
HTTP_MOVED_PERMANENTLY            = 301
HTTP_MOVED_TEMPORARILY            = 302
HTTP_NOT_MODIFIED                 = 304
HTTP_BAD_REQUEST                  = 400
HTTP_UNAUTHORIZED                 = 401
HTTP_FORBIDDEN                    = 403
HTTP_NOT_FOUND                    = 404
HTTP_INTERNAL_SERVER_ERROR        = 500
HTTP_NOT_IMPLEMENTED              = 501
HTTP_BAD_GATEWAY                  = 502
HTTP_SERVICE_UNAVAILABLE          = 503

def http_status_informational(status):
    return str(status).startswith('1')

def http_status_successful(status):
    return str(status).startswith('2')

def http_status_redirection(status):
    return str(status).startswith('3')

def http_status_client_error(status):
    return str(status).startswith('4')

def http_status_server_error(status):
    return str(status).startswith('5')

http_status_phrases = {
    HTTP_OK                       : "Ok",
    HTTP_CREATED                  : "Created",
    HTTP_ACCEPTED                 : "Accepted",
    HTTP_NO_CONTENT               : "No Content",
    HTTP_MULTIPLE_CHOICES         : "Multiple Choices",
    HTTP_MOVED_PERMANENTLY        : "Moved Permanently",
    HTTP_MOVED_TEMPORARILY        : "Moved Temporarily",
    HTTP_NOT_MODIFIED             : "Not Modified",
    HTTP_BAD_REQUEST              : "Bad Request",
    HTTP_UNAUTHORIZED             : "Unauthorized",
    HTTP_FORBIDDEN                : "Forbidden",
    HTTP_NOT_FOUND                : "Not Found",
    HTTP_INTERNAL_SERVER_ERROR    : "Internal Server Error",
    HTTP_NOT_IMPLEMENTED          : "Not Implemented",
    HTTP_BAD_GATEWAY              : "Bad Gateway",
    HTTP_SERVICE_UNAVAILABLE      : "Service Unavailable",
}

def http_status_string(status):
    try:
        return '%s %s' % (status, http_status_phrases[status])
    except KeyError:
        return '%s' % status

def commasplit(text):
    """ split a string into comma separated fields """
    return [f.strip() for f in text.split(',')]