Attachment 'IncludeWikiContent-1.8+1.9.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 """MoinMoin - IncludeWikiContent
   3 
   4 A macro to include another wiki page content with the context set to the current
   5 page. This Inclusion is not recursive (included pages won't get their
   6 IncludeWikiContent macro evaluated). 
   7 
   8 Usage: 
   9 	Use this macro to include common elements of your wiki, such as standard
  10 	subpages, headers etc...
  11 
  12 Syntax:
  13 	<<IncludeWikiContent(include page name)>>
  14 
  15 """
  16 
  17 from MoinMoin.Page import Page
  18 from MoinMoin import wikiutil
  19 from MoinMoin.parser.text_moin_wiki import Parser as WikiParser
  20 
  21 
  22 # do not cache
  23 Dependencies = ["namespace"]
  24 
  25 def execute(macro, args):
  26     request = macro.request
  27     content = []
  28     page_name = macro.formatter.page.page_name
  29 
  30     # get args
  31     include_page_name = ''
  32     if args is not None:
  33         include_page_name = args
  34 
  35     include_page_name = wikiutil.AbsPageName(page_name, include_page_name)
  36 
  37     include_page = Page(request, include_page_name)
  38 
  39     if include_page is None:
  40         return ''
  41     if not request.user.may.read(include_page_name):
  42         return ''
  43     else:
  44         return wikiutil.renderText(request, WikiParser, include_page.getPageText())

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] (2009-03-27 09:41:01, 1.1 KB) [[attachment:IncludeWikiContent-1.8+1.9.py]]
 All files | Selected Files: delete move to page copy to page

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