| OLD | NEW |
| (Empty) |
| 1 # coding=utf8 | |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 """Ignores issues not passing a authors regex.""" | |
| 6 | |
| 7 import re | |
| 8 | |
| 9 from verification import base | |
| 10 | |
| 11 | |
| 12 class AuthorVerifier(base.Verifier): | |
| 13 """Needs the author to match at least one regexp in self.regex.""" | |
| 14 name = 'author_white_list' | |
| 15 | |
| 16 def __init__(self, author_white_list): | |
| 17 super(AuthorVerifier, self).__init__() | |
| 18 self.author_white_list = author_white_list | |
| 19 | |
| 20 def verify(self, pending): | |
| 21 if not any(re.match(r, pending.owner) for r in self.author_white_list): | |
| 22 pending.verifications[self.name] = base.SimpleStatus( | |
| 23 state=base.FAILED, | |
| 24 error_message='Can\'t commit because the owner %s not in whitelist' % | |
| 25 pending.owner) | |
| 26 else: | |
| 27 pending.verifications[self.name] = base.SimpleStatus(base.SUCCEEDED) | |
| 28 | |
| 29 def update_status(self, queue): | |
| 30 pass | |
| OLD | NEW |