Represents a Help Topic. This generic implementation uses the filename extension for guess the type. This topic implementation supports plain text topics, restructured and structured text topics. HTML topics get rendered as structured text. If a file doesn't have the right file extension, use a explicit topic class for representing the right format.
>>> from zope.app.onlinehelp.tests.test_onlinehelp import testdir >>> path = os.path.join(testdir(), 'help.txt')
Create a Help Topic from a file
>>> topic = OnlineHelpTopic('help','Help',path,'')
Test the title
>>> topic.title 'Help'
Test the topic path
>>> topic.getTopicPath() 'help' >>> topic.parentPath = 'parent' >>> topic.getTopicPath() 'parent/help'
The type should be set to plaintext, since the file extension is 'txt'
>>> topic.type 'zope.source.plaintext'
Test the help content.
>>> topic.source u'This is a help!'>>> path = os.path.join(testdir(), 'help.stx') >>> topic = OnlineHelpTopic('help','Help',path,'')
The type should now be structured text
>>> topic.type 'zope.source.stx'
HTML files are treated as structured text files
>>> path = os.path.join(testdir(), 'help.html') >>> topic = OnlineHelpTopic('help','Help',path,'')
The type should still be structured text
>>> topic.type 'zope.source.stx'>>> path = os.path.join(testdir(), 'help.rst') >>> topic = OnlineHelpTopic('help','Help',path,'')
The type should now be restructured text
>>> topic.type 'zope.source.rest'
Resources can be added to an online help topic.
>>> topic.addResources(['test1.png', 'test2.png']) >>> topic['test1.png'].contentType 'image/png' >>> topic['test2.png'].contentType 'image/png'
id
(type:
unicode
)
u''
interface
(type: NoneType
)
None
parentPath
(type:
unicode
)
u''
path
(type:
unicode
)
u''
source
(type:
property
)
<property object at 0x40d3e784>
title
(type:
unicode
)
u''
type
(type: NoneType
)
None
view
(type: NoneType
)
None
addResources(resources)
see IOnlineHelpTopic
get(key, default=None)
See interface IReadContainer
getSubTopics()
getTopicPath()
See IOnlineHelpTopic
has_key(key)
See interface IReadContainer
items()
See interface IReadContainer
keys()
See interface IReadContainer
values()
See interface IReadContainer