Attachment 'ShortText-1.3.4-1.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - ShortText Macro
   4 
   5     PURPOSE:
   6         This macro is used to show the first 180 chars of a wikipage if the user is allowed to read the page
   7 
   8     CALLING SEQUENCE:
   9         [[ShortText(WikiName)]]
  10 
  11     PROCEDURE:
  12        This routine needs the macro RecommendPage and is used from this for the output
  13 
  14        Please remove the version number from the filename.
  15 
  16     EXAMPLES:
  17       [[ShortText(WikiName)]]
  18 
  19     MODIFICATION HISTORY:
  20         @copyright: 2005 by Reimar Bauer (R.Bauer@fz-juelich.de)
  21         @license: GNU GPL, see COPYING for details.
  22         Version: 1.3.4-1
  23 
  24 
  25 
  26 """
  27 
  28 from MoinMoin.action import RecommendPage
  29 from MoinMoin.Page import Page
  30 
  31 Dependencies = ["pages"]
  32 
  33 
  34 def execute(macro, pagename):
  35     request = macro.request
  36     _ = request.getText
  37 
  38     if request.user.may.read(pagename):
  39         thispage=Page(request,pagename)
  40         thisraw=thispage.get_raw_body()
  41 
  42         given_acl,thisraw = RecommendPage.ACLparse(request, thisraw)
  43         if (len(thisraw) > 180):
  44             return thisraw[0:180]
  45         else:
  46             return thisraw
  47 
  48     else:
  49       return ""

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-05-02 19:43:58, 1.1 KB) [[attachment:ShortText-1.3.4-1.py]]
  • [get | view] (2005-09-09 10:51:06, 1.1 KB) [[attachment:ShortText-1.3.5-2.py]]
  • [get | view] (2008-01-10 14:47:47, 1.5 KB) [[attachment:ShortText-1.6.0-3.py]]
 All files | Selected Files: delete move to page copy to page

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