diff options
| author | Barry Warsaw | 2009-03-29 15:40:22 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-03-29 15:40:22 -0500 |
| commit | 5388a2358749a1774bb801e6e6839c1798998a1f (patch) | |
| tree | 6bf6f2a10f1f1f588d5ca6d2f4c8ec8e6530cb4a /src/mailman/commands/cmd_help.py | |
| parent | f90c651d85050b9ad3b33bdf210672452d2ba1f0 (diff) | |
| download | mailman-5388a2358749a1774bb801e6e6839c1798998a1f.tar.gz mailman-5388a2358749a1774bb801e6e6839c1798998a1f.tar.zst mailman-5388a2358749a1774bb801e6e6839c1798998a1f.zip | |
Add argparse 'cause I think this might end up being cool.
Refactor the finding of components so that it's much easier to find and
register the ones that come with Mailman by default.
Move all the old cmd_*.py commands into the attic. These will eventually be
ported to the new framework.
Diffstat (limited to 'src/mailman/commands/cmd_help.py')
| -rw-r--r-- | src/mailman/commands/cmd_help.py | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/src/mailman/commands/cmd_help.py b/src/mailman/commands/cmd_help.py deleted file mode 100644 index 30c8dc4d6..000000000 --- a/src/mailman/commands/cmd_help.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (C) 2002-2009 by the Free Software Foundation, Inc. -# -# This file is part of GNU Mailman. -# -# GNU Mailman is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. - -""" - help - Print this help message. -""" - -import os -import sys - -from mailman import Utils -from mailman.config import config -from mailman.i18n import _ - -EMPTYSTRING = '' - - - -def gethelp(mlist): - return _(__doc__) - - - -def process(res, args): - # Get the help text introduction - mlist = res.mlist - # Since this message is personalized, add some useful information if the - # address requesting help is a member of the list. - msg = res.msg - for sender in msg.senders: - if mlist.isMember(sender): - memberurl = mlist.GetOptionsURL(sender, absolute=1) - urlhelp = _( - 'You can access your personal options via the following url:') - res.results.append(urlhelp) - res.results.append(memberurl) - # Get a blank line in the output. - res.results.append('') - break - # build the specific command helps from the module docstrings - modhelps = {} - import mailman.Commands - path = os.path.dirname(os.path.abspath(mailman.Commands.__file__)) - for file in os.listdir(path): - if not file.startswith('cmd_') or not file.endswith('.py'): - continue - module = os.path.splitext(file)[0] - modname = 'mailman.Commands.' + module - try: - __import__(modname) - except ImportError: - continue - cmdname = module[4:] - help = None - if hasattr(sys.modules[modname], 'gethelp'): - help = sys.modules[modname].gethelp(mlist) - if help: - modhelps[cmdname] = help - # Now sort the command helps - helptext = [] - keys = modhelps.keys() - keys.sort() - for cmd in keys: - helptext.append(modhelps[cmd]) - commands = EMPTYSTRING.join(helptext) - # Now craft the response - helptext = Utils.maketext( - 'help.txt', - {'listname' : mlist.real_name, - 'version' : config.VERSION, - 'listinfo_url': mlist.GetScriptURL('listinfo', absolute=1), - 'requestaddr' : mlist.GetRequestEmail(), - 'adminaddr' : mlist.GetOwnerEmail(), - 'commands' : commands, - }, mlist=mlist, lang=res.msgdata['lang'], raw=1) - # Now add to the response - res.results.append('help') - res.results.append(helptext) |
