Added a check for the already-presence of an attribute.

This commit is contained in:
Jeremy Fincher 2004-08-03 14:01:54 +00:00
parent 2bd7a31c27
commit da7e93a283
1 changed files with 4 additions and 0 deletions

View File

@ -641,6 +641,10 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
s = '%s is not a valid command in the %s plugin.' % (name, plugin)
irc.error(s)
return
if hasattr(cb, name):
irc.error('The %s plugin already has an attribute named %s.' %
(plugin, name))
return
method = getattr(cb.__class__, command)
setattr(cb.__class__, name, method)
delattr(cb.__class__, command)