Fix up Plugin.contributors and a couple contributors dicts.

This commit is contained in:
James Vega 2005-04-26 02:53:08 +00:00
parent 44ef2bd81a
commit df73547745
3 changed files with 13 additions and 7 deletions

View File

@ -42,7 +42,7 @@ __author__ = supybot.authors.jemfinch
# This is a dictionary mapping supybot.Author instances to lists of
# contributions.
__contributors__ = {supybot.authors.jamessan:'whois'}
__contributors__ = {supybot.authors.jamessan: ['whois']}
import config
import plugin

View File

@ -42,7 +42,7 @@ __author__ = supybot.authors.jemfinch
# This is a dictionary mapping supybot.Author instances to lists of
# contributions.
__contributors__ = {supybot.Author('Keith Jones', 'kmj', ''): 'convert'}
__contributors__ = {supybot.Author('Keith Jones', 'kmj', ''): ['convert']}
import config
import plugin

View File

@ -147,12 +147,12 @@ class Plugin(callbacks.Plugin):
contrib = 'has no contributors listed.'
hasAuthor = False
hasContribs = False
if getattr(module, '__author__', None):
if hasattr(module, '__author__'):
if module.__author__ != supybot.authors.unknown:
author = 'was written by %s' % \
utils.web.mungeEmail(str(module.__author__))
hasAuthor = True
if getattr(module, '__contributors__', None):
if hasattr(module, '__contributors__'):
contribs = sortAuthors()
if hasAuthor:
try:
@ -175,7 +175,14 @@ class Plugin(callbacks.Plugin):
for the requested plugin
"""
isAuthor = False
authorInfo = getattr(supybot.authors, nick, None)
authorInfo = None
moduleContribs = module.__contributors__.keys()
lnick = nick.lower()
for contrib in moduleContribs:
if contrib.nick.lower() == lnick:
authorInfo = contrib
break
authorInfo = authorInfo or getattr(supybot.authors, nick, None)
if not authorInfo:
return 'The nick specified (%s) is not a registered ' \
'contributor.' % nick
@ -186,8 +193,7 @@ class Plugin(callbacks.Plugin):
return 'The %s plugin does not have \'%s\' listed as a ' \
'contributor.' % (cb.name(), nick)
contributions = module.__contributors__[authorInfo]
if getattr(module, '__author__', False) == authorInfo:
isAuthor = True
isAuthor = getattr(module, '__author__', False) == authorInfo
(nonCommands, commands) = utils.iter.partition(lambda s: ' ' in s,
contributions)
results = []