Attachment 'LoginLink.py'

Download

   1 # -*- coding: utf-8 -*-
   2 """
   3     MoinMoin - LoginLink
   4 
   5     Usage:
   6         <<LoginLink('Please login')>>
   7 
   8     @copyright: 2010 Gunnar Scherf
   9     @license: GNU GPL, see COPYING for details
  10 
  11     changes:
  12 
  13 """
  14 
  15 Dependencies = ["language"]
  16 
  17 def macro_LoginLink(macro, text=u"Login"):
  18     if macro.request.user.valid:
  19         return ''
  20 
  21     _ = macro.request.getText
  22     text = _(text)
  23     page = macro.formatter.page
  24     url = page.url(macro.request, {'action':'login'})
  25     return ''.join([macro.formatter.url(1, url, css='action'), macro.formatter.text(text), macro.formatter.url(0), ])
  26 															    

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] (2010-04-11 18:41:34, 0.6 KB) [[attachment:LoginLink.py]]
 All files | Selected Files: delete move to page copy to page

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