Attachment 'usemli-1.9.7.py'

Download

   1 # -*- coding: UTF8 -*-
   2 """
   3     MoinMoin - USer-EMail-LIst
   4 
   5     Creates an email link to contact all wiki users.
   6 
   7     @copyright: 2013-2014 Dirk Alders <d.aldersr@arcor.de>,
   8     @license: GNU GPL, see COPYING for details.
   9 """
  10 
  11 from MoinMoin import user
  12 
  13 
  14 class Macro:
  15     all = 1
  16     active = 2
  17     name = {1: 'All Users', 2: 'Active Users'}
  18 
  19     def __init__(self, macro, needle):
  20         self.request = macro.request
  21         self.formatter = self.request.formatter
  22 
  23     def do(self):
  24         html = self.email_list(self.active)
  25         html += ', '
  26         html += self.email_list(self.all)
  27         html += '<br>\n'
  28         self.request.write(self.formatter.rawHTML(html))
  29         return ''
  30 
  31     def email_list(self, list_type):
  32         rv = '<a class="mailto" href="mailto:'
  33         for uid in user.getUserList(self.request):
  34             if user.User(self.request, uid).disabled == 0 or list_type == self.all:
  35                 rv += user.User(self.request, uid).email + ', '
  36         rv = rv[:-2] + '">%s</a>' % self.name[list_type]
  37         return rv
  38 
  39 
  40 def execute(macro, needle):
  41     return Macro(macro, needle).do()

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] (2014-01-04 23:06:15, 1.1 KB) [[attachment:usemli-1.9.7.py]]
 All files | Selected Files: delete move to page copy to page

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