You are here: Home / Documentation / How To's / kimGenPageLinks.py

kimGenPageLinks.py

by nguyen — published Aug 26, 2009 12:15 PM, last modified Aug 16, 2016 10:50 AM
Converts the "links" HTML files into normal Plone pages. See description of the kimGenPages.py file for more detail.

HTML icon — HTML, 1 KB

File contents

def doFile(file):
    if file in context.objectIds():
        context.manage_delObjects(file)
    doc = context.invokeFactory(type_name='Document', id=file)
    ok = doc in context.objectIds()
    docObj = context[doc]
    newText=str(srcFolder[file])
    newText = newText.replace('<h2>','<div class="links"><h2>')
    newText = newText.replace('<a href="javascript:history.back()"><img height=29 alt="Click here to go Back" src  ="../images/back.gif" width=92 /></a>','<br>Return to <a href="..">"What Can I Do With This Major"</a><br>')
    newText = newText.replace('</body>','</div>')
    docObj.setText(newText)
    print "created document %s" % doc
    return printed

srcFolder=context['src']
srcFiles=srcFolder.objectIds()

for f in srcFiles:
    print doFile(f)

return printed
Navigation