Attachment 'Up.py'

Download

   1 """
   2   MoinMoin - Up Macro
   3 
   4   Written by Daniela Nicklas <dani@miracle-solutions.de>
   5 
   6   Useful for Subpages: inserts a link to move up one level, e.g. from
   7   FirstLevel/SecondLevel to FirstLevel. If the page is no subpage, link goes to  Frontpage
   8 """
   9 
  10 from MoinMoin.Page import Page
  11 from MoinMoin import config
  12 import sys
  13 import cStringIO
  14 import string
  15 
  16 def execute(macro, args):
  17 
  18     pagename = macro.formatter.page.page_name
  19     plist = string.split(pagename, "/");
  20     pagename = ""
  21     
  22     if len(plist) == 1:
  23         pagename = config.page_front_page
  24     else:
  25         # last element is omitted
  26         plist = plist[:-1]
  27         pagename = string.join(plist, "/");
  28     
  29     p = Page(pagename);
  30 
  31     content = p.link_to()
  32 
  33     return content

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] (2003-12-07 18:15:54, 0.4 KB) [[attachment:Color.py]]
  • [get | view] (2003-12-07 18:15:54, 1.3 KB) [[attachment:Nav.py]]
  • [get | view] (2003-12-07 18:15:54, 0.7 KB) [[attachment:Up.py]]
  • [get | view] (2004-03-04 18:39:13, 4.6 KB) [[attachment:Vote.py]]
  • [get | view] (2003-12-07 18:15:54, 4.6 KB) [[attachment:Vote2.py]]
 All files | Selected Files: delete move to page copy to page

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