BetterWikiDocs

Attachment 'migrate_pages.py'

Download

   1 import os.path
   2 import shutil
   3 import sys
   4 
   5 from MoinMoin import PageEditor, wikiutil
   6 from MoinMoin.request import RequestCLI
   7 from MoinMoin import search
   8 
   9 liveRun = True
  10 
  11 def main(destination):
  12     query = search.QueryParser().parse_query('CategoryDocumentation')
  13     request = RequestCLI(url='foo')
  14     results = search.searchPages(request, query)
  15     for hit in results.hits:
  16         page = PageEditor.PageEditor(request, hit.page_name, do_editor_backup=0)
  17         shutil.copytree(page.getPagePath(), 
  18                         os.path.join(destination, 
  19                                      wikiutil.quoteWikinameFS(page.page_name)))
  20         if liveRun:
  21             print "Writing %s ..." % repr(page.page_name)
  22             page._write_file("#refresh 0 http://help.ubuntu.com/community/" +
  23                              wikiutil.quoteWikinameURL(page.page_name))
  24 
  25 if __name__ == '__main__':
  26     main(sys.argv[1])

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2005-12-01 00:09:27, 10.8 KB) [[attachment:doc-henrik.odg]]
  • [get | view] (2005-12-01 00:08:12, 12.3 KB) [[attachment:doc-matt.odg]]
  • [get | view] (2006-05-19 06:11:49, 0.9 KB) [[attachment:migrate_pages.py]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.