OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import contextlib | 5 import contextlib |
6 import datetime | 6 import datetime |
7 import logging | 7 import logging |
8 import urlparse | 8 import urlparse |
9 | 9 |
10 from google.appengine.api import taskqueue | 10 from google.appengine.api import taskqueue |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 raise errors.InvalidInputError('Buckets must be a list or None') | 318 raise errors.InvalidInputError('Buckets must be a list or None') |
319 validate_tags(tags) | 319 validate_tags(tags) |
320 tags = tags or [] | 320 tags = tags or [] |
321 max_builds = fix_max_builds(max_builds) | 321 max_builds = fix_max_builds(max_builds) |
322 created_by = parse_identity(created_by) | 322 created_by = parse_identity(created_by) |
323 | 323 |
324 if buckets: | 324 if buckets: |
325 _check_search_acls(buckets) | 325 _check_search_acls(buckets) |
326 elif retry_of: | 326 elif retry_of: |
327 retry_of_build = model.Build.get_by_id(retry_of) | 327 retry_of_build = model.Build.get_by_id(retry_of) |
328 if retry_of_build: | 328 if retry_of_build: # pragma: no cover |
329 buckets = [retry_of_build.bucket] | 329 buckets = [retry_of_build.bucket] |
330 else: | 330 else: |
331 buckets = acl.get_available_buckets() | 331 buckets = acl.get_available_buckets() |
332 if buckets is not None and len(buckets) == 0: | 332 if buckets is not None and len(buckets) == 0: |
333 return [], None | 333 return [], None |
334 if buckets: | 334 if buckets: |
335 buckets = set(buckets) | 335 buckets = set(buckets) |
336 assert buckets is None or buckets | 336 assert buckets is None or buckets |
337 | 337 |
338 check_buckets_locally = retry_of is not None | 338 check_buckets_locally = retry_of is not None |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 if isinstance(identity, basestring): | 833 if isinstance(identity, basestring): |
834 if not identity: # pragma: no cover | 834 if not identity: # pragma: no cover |
835 return None | 835 return None |
836 if ':' not in identity: # pragma: no branch | 836 if ':' not in identity: # pragma: no branch |
837 identity = 'user:%s' % identity | 837 identity = 'user:%s' % identity |
838 try: | 838 try: |
839 identity = auth.Identity.from_bytes(identity) | 839 identity = auth.Identity.from_bytes(identity) |
840 except ValueError as ex: | 840 except ValueError as ex: |
841 raise errors.InvalidInputError('Invalid identity identity: %s' % ex) | 841 raise errors.InvalidInputError('Invalid identity identity: %s' % ex) |
842 return identity | 842 return identity |
OLD | NEW |