1 """
   2     MoinMoin - SystemInfo2 macro
   3 
   4     Copyright (c) 2003 by Th.Fanslau <tfanslau@gmx.de>
   5     All rights reserved, see COPYING for details.
   6 
   7     Creates Systeminfo differently.
   8 
   9     Usage:
  10         [[SystemInfo2]]
  11 
  12 """
  13 
  14 import sys, re, cStringIO
  15 from MoinMoin import version, editlog, wikiutil, config
  16 from MoinMoin import processor
  17 from MoinMoin import Page
  18 from MoinMoin import macro as macro1
  19 from MoinMoin.i18n import _
  20 
  21 def execute(macro, text):
  22     ret = ''
  23 
  24     edlog = editlog.EditLog()
  25 
  26     values = [
  27         ' ' + _('Python Version') + ' :: %s' % sys.version,
  28         ' ' + _('MoinMoin Version') + ' :: %s' % _('Release %s [Revision %s]') % (version.release, version.revision),
  29         ' ' + _('Number of pages') + ' :: %i' % len(wikiutil.getPageList(config.text_dir)),
  30         ' ' + _('Number of backup versions') + ' :: %i' % len(wikiutil.getBackupList(config.backup_dir, None)),
  31         ' ' + _('Global extension macros') + ' :: %s' % (', '.join(macro1.extension_macros) or _("<b>NONE<b>"))
  32         ]
  33 
  34     ret = "\n".join(values)
  35 
  36     # output page
  37 
  38     page = Page.Page("SystemInfo")
  39     page.raw_body = ret
  40     stdout = sys.stdout
  41     sys.stdout = cStringIO.StringIO()
  42     page.send_page(macro.request, content_only=1)
  43     ret = sys.stdout.getvalue()
  44     sys.stdout = stdout
  45 
  46     # return text
  47     return ret
  48 
  49 #*#

MoinMoin: macro/SystemInfo2.py (last edited 2007-10-29 19:13:46 by localhost)