This file is indexed.

/usr/bin/zconfig_schema2html is in python-zconfig 3.1.0-1.

This file is owned by root:root, with mode 0o755.

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
115
#!/usr/bin/python
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

__version__ = '$Revision: 1.3 $'[11:-2]

import sys
import os
import cgi

if __name__ == "__main__":
    here = os.path.dirname(os.path.realpath(__file__))
    swhome = os.path.dirname(here)
    for parts in [("src",), ("lib", "python"), ("Lib", "site-packages")]:
        d = os.path.join(swhome, *(parts + ("ZConfig",)))
        if os.path.isdir(d):
            d = os.path.join(swhome, *parts)
            sys.path.insert(0, d)
            break

import ZConfig.loader
from ZConfig.info import *

def esc(x): return cgi.escape(str(x))
def dt(x):
    tn = type(x).__name__
    if tn == 'instance':
        return '%s %s'%(tn, x.__class__.__module__ + '.' + x.__class__.__name__)
    elif tn == 'class':
        return '%s %s'%(tn, x.__module__ + '.' + x.__name__)
    else:
        return '%s %s'%(tn, x.__name__)

class explain:
    done = []
    def __call__(self, st):
        if st.name in self.done:
            return
        self.done.append(st.name)

        if st.description:
            print st.description
        for sub in st.getsubtypenames():
            print '<dl>'
            printContents(None, st.getsubtype(sub))
            print '</dl>'
explain = explain()

def printSchema(schema):
    print '<dl>'
    for child in schema:
        printContents(*child)
    print '</dl>'

def printContents(name, info):
    if isinstance(info, SectionType):
        print '<dt><b><i>', info.name, '</i></b> (%s)</dt>'%dt(info.datatype)
        print '<dd>'
        if info.description:
            print info.description
        print '<dl>'
        for sub in info:
            printContents(*sub)
        print '</dl></dd>'
    elif isinstance(info, SectionInfo):
        st = info.sectiontype
        if st.isabstract():
            print '<dt><b><i>', st.name, '</i>', info.name, '</b></dt>'
            print '<dd>'
            if info.description:
                print info.description
            explain(st)
            print '</dd>'
        else:
            print '<dt><b>', info.attribute, info.name, '</b>'
            print '(%s)</dt>'%dt(info.datatype)
            print '<dd><dl>'
            for sub in info.sectiontype:
                printContents(*sub)
            print '</dl></dd>'
    else:
        print '<dt><b>',info.name, '</b>', '(%s)'%dt(info.datatype)
        default = info.getdefault()
        if isinstance(default, ValueInfo):
            print '(default: %r)'%esc(default.value)
        elif default is not None:
            print '(default: %r)'%esc(default)
        if info.metadefault:
            print '(metadefault: %s)' % info.metadefault
        print '</dt>'
        if info.description:
            print '<dd>',info.description,'</dd>'

schema = ZConfig.loader.loadSchemaFile(sys.argv[1])

print '''<html><body>
<style>
dl {margin: 0 0 1em 0;}
</style>
'''
printSchema(schema)
print '</body></html>'

# vim: set filetype=python ts=4 sw=4 et si