[Zope] Manipulating Structured Text Document using Tree.py

Colin Leath cleath@j9k.com
Mon, 09 Sep 2002 18:26:40 +0000


Hello,
I'm attempting to create an expandable/collapsible tree type document
(e.g. msword outline style) from the body of CMFDocument containing
structured text. For some background please visit:
http://lists.zope.org/pipermail/zope-cmf/2002-September/015096.html

Below, I've pasted the External Method I've been working on, which
instead of the EditableBody of CMFDocument is using a file on
filesystem containing STX.

My problem is that I'm getting the following error:

[Which occurs when the following call is made:
     tree, rows = tm.cookieTree(tree_root)]

Module ZTUtils.Tree, line 139, in getChildren
AttributeError: StructuredTextDocument instance has no attribute
'tpValues'


Does anyone have any hints about how I should proceed now?

Thanks!
Colin


__doc__='''Method for creating collapsible trees from structured text
'''

from ZTUtils import SimpleTreeMaker

def StTree(self, REQUEST):
    raw=open("/home/cleath/Extensions/StTreeOld/tstx",'r').read()
    import StructuredText
    st=StructuredText.Basic(raw)
    st.REQUEST = REQUEST
    #st.tpValues = None 
    
    tree_root = st
    tree_pre = 'tree'
    
    tm = SimpleTreeMaker(tree_pre)
    tm.setSkip('')
  
    tree, rows = tm.cookieTree(tree_root)
    rows.pop(0)
    
    print rows