Class
zope.app.onlinehelp.onlinehelp.OnlineHelp

>>> import os
>>> from zope import component
>>> from zope.component.interfaces import IFactory
>>> from zope.component.factory import Factory
>>> from zope.app.onlinehelp.tests.test_onlinehelp import testdir
>>> from zope.app.onlinehelp.tests.test_onlinehelp import I1, Dummy1
>>> path = os.path.join(testdir(), 'help.txt')

Create an OnlineHelp instance

>>> onlinehelp = OnlineHelp('Help', path)

First do the interface verifying tests.

>>> from zope.interface.verify import verifyObject
>>> from zope.traversing.interfaces import IContainmentRoot
>>> verifyObject(IOnlineHelp, onlinehelp)
True
>>> verifyObject(IContainmentRoot, onlinehelp)
True

Register a new subtopic for interface 'I1' and view 'view.html'

>>> from zope.app.onlinehelp.onlinehelptopic import OnlineHelpTopic
>>> from zope.app.onlinehelp.onlinehelptopic import RESTOnlineHelpTopic
>>> from zope.app.onlinehelp.onlinehelptopic import STXOnlineHelpTopic
>>> from zope.app.onlinehelp.onlinehelptopic import ZPTOnlineHelpTopic
>>> default = Factory(OnlineHelpTopic)
>>> rest = Factory(RESTOnlineHelpTopic)
>>> stx = Factory(STXOnlineHelpTopic)
>>> zpt = Factory(ZPTOnlineHelpTopic)
>>> component.provideUtility(default, IFactory, 'onlinehelp.topic.default')
>>> component.provideUtility(rest, IFactory, 'onlinehelp.topic.rest')
>>> component.provideUtility(stx, IFactory, 'onlinehelp.topic.stx')
>>> component.provideUtility(zpt, IFactory, 'onlinehelp.topic.zpt')
>>> path = os.path.join(testdir(), 'help2.txt')
>>> onlinehelp.registerHelpTopic('', 'help2', 'Help 2',
...     path, I1, 'view.html')

Test if the subtopic is set correctly >>> onlinehelp['help2'].title 'Help 2'

Additionally it should appear as a utility >>> from zope.app import zapi >>> topic = zapi.getUtility(IOnlineHelpTopic,'help2') >>> topic.title 'Help 2'

add another topic without parent >>> onlinehelp.registerHelpTopic('missing', 'help3', 'Help 3', ... path, I1, 'view.html')

The new topic should not be a child of the onlinehelp instance >>> 'help3' in onlinehelp.keys() False

But it is available as a utility >>> topic = zapi.getUtility(IOnlineHelpTopic,'missing/help3') >>> topic.title 'Help 3'

now register the missing parent >>> onlinehelp.registerHelpTopic('', 'missing', 'Missing', ... path, I1, 'view.html')

This is a child on the onlinehelp >>> 'missing' in onlinehelp.keys() True

>>> missing = onlinehelp['missing']

This topic should now have 'help3' as a child >>> 'help3' in missing.keys() True

Base classes

Implemented Interfaces

Attributes/Properties

Methods

Known Subclasses