Made some semantic code changes

Fixed an error with properly pluralizing the word 'command' in the contributions output
This commit is contained in:
Kevin Murphy 2004-09-13 07:11:54 +00:00
parent ee9a89e6a1
commit 92ae571aca

View File

@ -716,16 +716,15 @@ class Misc(callbacks.Privmsg):
if getattr(module, '__author__', False) == authorInfo: if getattr(module, '__author__', False) == authorInfo:
isAuthor = True isAuthor = True
# XXX Partition needs moved to utils. # XXX Partition needs moved to utils.
splitContribs = fix.partition(lambda s: ' ' in s, contributions) (nonCommands, commands) = fix.partition(lambda s: ' ' in s,
contributions)
results = [] results = []
# XXX Assign splitContribs to specific names based on what it means if commands:
# semantically -- (foo, bar) = partition(...)
if splitContribs[1]:
results.append( results.append(
'the %s %s' %(utils.commaAndify(splitContribs[1]), 'the %s %s' %(utils.commaAndify(commands),
utils.pluralize('command',splitContribs[1]))) utils.pluralize('command',len(commands))))
if splitContribs[0]: if nonCommands:
results.append('the %s' % utils.commaAndify(splitContribs[0])) results.append('the %s' % utils.commaAndify(nonCommands))
if results and isAuthor: if results and isAuthor:
return '%s wrote the %s plugin and also contributed %s' % \ return '%s wrote the %s plugin and also contributed %s' % \
(fullName, plugin, utils.commaAndify(results)) (fullName, plugin, utils.commaAndify(results))