Example #1
0
def printTreeDocs(rootTopic=None, **kwargs):
    '''Uses the TopicTreePrinter to print out the topic tree 
    to stdout, starting at rootTopic The kwargs are the same as 
    for TopicTreePrinter constructor. '''
    printer = TopicTreePrinter(**kwargs)
    if rootTopic is None:
        from pubsub import pub
        rootTopic = pub.getDefaultRootTopic()
    assert rootTopic is not None
    printer.traverse(rootTopic)
Example #2
0
def printTreeSpec(rootTopic=None, **kwargs):
    '''Prints the topic tree specification starting from rootTopic. 
    If not specified, the whole topic tree is printed. The kwargs are the 
    same as TopicTreeAsSpec's constructor. If no header or footer are given, the 
    defaults are used (see defaultTopicTreeSpecHeader and 
    defaultTopicTreeSpecFooter), such that the resulting output can be 
    imported in your application. E.g.::
    
        pyFile = file('appTopicTree.py','w')
        printTreeSpec( pyFile )
        pyFile.close()
        import appTopicTree
    '''
    kwargs.setdefault('header', defaultTopicTreeSpecHeader)
    kwargs.setdefault('footer', defaultTopicTreeSpecFooter)
    printer = TopicTreeAsSpec(**kwargs)
    if rootTopic is None:
        from pubsub import pub
        rootTopic = pub.getDefaultRootTopic()
    assert rootTopic is not None
    printer.traverse(rootTopic)