def __init__(self, server = None, repoName = None, url = None): """ Initialize an InsufficientPermission exception object. This exception is raised when privileged methods are called without the correct authorization token. @param server: Name of the host where access is denied. @type server: string @param repoName: Name of the repository where access is denied. @type repoName: string @param url: URL of the call where access is denied. @type url: string """ self.server = self.repoName = self.url = None serverMsg = repoMsg = urlMsg = "" if server: self.server = server serverMsg = ("server %s" % server) if repoName: self.repoName = repoName repoMsg = ("repository %s" % repoName) if url: self.url = url urlMsg = ("via %s" % (url,)) if server or repoName or url: msg = "Insufficient permission to access %s %s %s" %( repoMsg, serverMsg, urlMsg) else: msg = "Insufficient permission" ConaryError.__init__(self, msg)
def __init__(self, server=None, repoName=None, url=None): """ Initialize an InsufficientPermission exception object. This exception is raised when privileged methods are called without the correct authorization token. @param server: Name of the host where access is denied. @type server: string @param repoName: Name of the repository where access is denied. @type repoName: string @param url: URL of the call where access is denied. @type url: string """ self.server = self.repoName = self.url = None serverMsg = repoMsg = urlMsg = "" if server: self.server = server serverMsg = ("server %s" % server) if repoName: self.repoName = repoName repoMsg = ("repository %s" % repoName) if url: self.url = url urlMsg = ("via %s" % (url, )) if server or repoName or url: msg = "Insufficient permission to access %s %s %s" % ( repoMsg, serverMsg, urlMsg) else: msg = "Insufficient permission" ConaryError.__init__(self, msg)
def __init__(self, right = None, wrong = None): if issubclass(right.__class__, list): right = list(right) self.right = right self.wrong = wrong if right and wrong: detail = '' if isinstance(right, list): # turn multiple server names into something more readable if len(right) > 1: right = ', '.join('"%s"' %x for x in right) right = 'one of ' + right else: right = '"%s"' %right[0] else: right = '"%s"' %right msg = ('Repository name mismatch. The correct repository name ' 'is %s, but it was accessed as "%s". Check for ' 'incorrect repositoryMap configuration entries.' % (right, wrong)) else: msg = ('Repository name mismatch. Check for incorrect ' 'repositoryMap entries.') ConaryError.__init__(self, msg)
def __init__(self, right=None, wrong=None): if issubclass(right.__class__, list): right = list(right) self.right = right self.wrong = wrong if right and wrong: detail = '' if isinstance(right, list): # turn multiple server names into something more readable if len(right) > 1: right = ', '.join('"%s"' % x for x in right) right = 'one of ' + right else: right = '"%s"' % right[0] else: right = '"%s"' % right msg = ('Repository name mismatch. The correct repository name ' 'is %s, but it was accessed as "%s". Check for ' 'incorrect repositoryMap configuration entries.' % (right, wrong)) else: msg = ('Repository name mismatch. Check for incorrect ' 'repositoryMap entries.') ConaryError.__init__(self, msg)