3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

API CHANGE: Rename NotAuthenticatedError -> NotAuthorizedError

This commit is contained in:
James Lu 2016-08-25 00:43:44 -07:00
parent 7d2b22630d
commit 5908776a86
2 changed files with 4 additions and 4 deletions

View File

@ -953,13 +953,13 @@ class Irc():
def checkAuthenticated(self, uid, allowAuthed=True, allowOper=True):
"""
Checks whether the given user has operator status on PyLink, raising
NotAuthenticatedError and logging the access denial if not.
NotAuthorizedError and logging the access denial if not.
"""
lastfunc = inspect.stack()[1][3]
if not self.isOper(uid, allowAuthed=allowAuthed, allowOper=allowOper):
log.warning('(%s) Access denied for %s calling %r', self.name,
self.getHostmask(uid), lastfunc)
raise utils.NotAuthenticatedError("You are not authenticated!")
raise utils.NotAuthorizedError("You are not authenticated!")
return True
def matchHost(self, glob, target, ip=True, realhost=True):

View File

@ -16,7 +16,7 @@ from . import world, conf
# This is just so protocols and plugins are importable.
from pylinkirc import protocols, plugins
class NotAuthenticatedError(Exception):
class NotAuthorizedError(Exception):
"""
Exception raised by checkAuthenticated() when a user fails authentication
requirements.
@ -266,7 +266,7 @@ class ServiceBot():
for func in self.commands[cmd]:
try:
func(irc, source, cmd_args)
except NotAuthenticatedError as e:
except NotAuthorizedError as e:
self.reply(irc, 'Error: Not authorized. %s' % e)
except Exception as e:
log.exception('Unhandled exception caught in command %r', cmd)