From: Ansgar Burchardt Date: Mon, 24 Sep 2012 18:41:44 +0000 (+0200) Subject: daklib/checks.py: include acl name in reason for rejection X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41753c0bff897c3007af9d80f79b3e404c4b9647;p=dak daklib/checks.py: include acl name in reason for rejection --- diff --git a/daklib/checks.py b/daklib/checks.py index cae801e4..56468639 100644 --- a/daklib/checks.py +++ b/daklib/checks.py @@ -53,6 +53,15 @@ class RejectStupidMaintainerException(Exception): def __str__(self): return "'%s' has mismatching %s from the external files db ('%s' [current] vs '%s' [external])" % self.args[:4] +class RejectACL(Reject): + """exception raise by failing ACL checks""" + def __init__(self, acl, reason): + self.acl = acl + self.reason = reason + + def __str__(self): + return "ACL {0}: {1}".format(self.acl.name, self.reason) + class Check(object): """base class for checks @@ -528,12 +537,12 @@ class ACLCheck(Check): raise Reject('No ACL for fingerprint {0}'.format(fingerprint.fingerprint)) result, reason = self._check_acl(session, upload, acl) if not result: - raise Reject(reason) + raise RejectACL(acl, reason) for acl in session.query(ACL).filter_by(is_global=True): result, reason = self._check_acl(session, upload, acl) if result == False: - raise Reject(reason) + raise RejectACL(acl, reason) return True