Logo Search packages:      
Sourcecode: zope-docfindereverywhere version File versions  Download package


# DocFinderEverywhere 0.4.1
# (c) 2001-2002, Stefan H. Holek, stefan@epy.co.at
# http://www.zope.org/Members/shh/
# License: ZPL
# Zope: 2.3.3 or higher

# Monkey patch wrapper around Dieter Maurer's DocFinder product
# http://www.dieter.handshake.de/pyprojects/zope/DocFinder.html
# Adds a Doc tab to all Zope objects

# Thanks to Dieter for his input on how to make this work with 
# PythonScripts and ExternalMethods, and for writing DocFinder 
# in the first place.

__doc__ = 'Add a Doc tab to all Zope objects'
__version__ = '0.4.1'

__refresh_module__ = 0


    from Globals import HTMLFile
    from App.Management import Tabs
    from OFS.SimpleItem import Item
    from analyse import DocFinder
    from AccessControl import getSecurityManager
    from AccessControl.PermissionRole import PermissionRole
    from Permissions import ViewDocPermission, ViewDocDefaultRoles

    def filtered_manage_options(self, REQUEST=None):
        # Append a Doc tab to an object's management tabs
        tabs = self._old_filtered_manage_options(REQUEST)
        secman = getSecurityManager()
        if len(tabs) and secman.checkPermission(ViewDocPermission, self.this()):
            tabs.append( {'label': 'Doc', 
                          'action': 'showDocumentation', 
                          'help': ('DocFinderEverywhere', 'README.stx')} )
        return tabs

    Tabs._old_filtered_manage_options = Tabs.filtered_manage_options
    Tabs.filtered_manage_options = filtered_manage_options

    showDocumentation = HTMLFile('dtml/showDocumentation', globals())

    def analyseDocumentation(self, object, type='scripter', filter=''):
        return DocFinder(object, type, filter)
    ViewDocRoles = PermissionRole(ViewDocPermission, ViewDocDefaultRoles)

    Item.showDocumentation = showDocumentation
    Item.showDocumentation__roles__ = ViewDocRoles
    Item.analyseDocumentation = analyseDocumentation
    Item.analyseDocumentation__roles__ = ViewDocRoles

    from zLOG import LOG, INFO
    LOG('DocFinderEverywhere', INFO, 'Applied patch version %s.' % __version__)


    import traceback

Generated by  Doxygen 1.6.0   Back to index