Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: appengine/cr-buildbucket/errors.py

Issue 1082303002: buildbucket: put_batch endpoint (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: removed memcache import Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/cr-buildbucket/api.py ('k') | appengine/cr-buildbucket/service.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 re 5 import re
6 6
7 7
8 BUCKET_NAME_REGEX = re.compile(r'^[0-9a-z_\.\-/]{1,100}$') 8 BUCKET_NAME_REGEX = re.compile(r'^[0-9a-z_\.\-/]{1,100}$')
9 9
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 class LeaseExpiredError(Error): 31 class LeaseExpiredError(Error):
32 """Raised when provided lease_key does not match the current one.""" 32 """Raised when provided lease_key does not match the current one."""
33 33
34 34
35 def validate_bucket_name(bucket): 35 def validate_bucket_name(bucket):
36 """Raises InvalidInputError if bucket name is invalid.""" 36 """Raises InvalidInputError if bucket name is invalid."""
37 if not bucket: 37 if not bucket:
38 raise InvalidInputError('Bucket not specified') 38 raise InvalidInputError('Bucket not specified')
39 if not isinstance(bucket, basestring): 39 if not isinstance(bucket, basestring):
40 raise InvalidInputError('Bucket must be a string') 40 raise InvalidInputError(
41 'Bucket must be a string. It is %s.' % type(bucket).__name__)
41 if not BUCKET_NAME_REGEX.match(bucket): 42 if not BUCKET_NAME_REGEX.match(bucket):
42 raise InvalidInputError( 43 raise InvalidInputError(
43 'Bucket name "%s" does not match regular expression %s' % 44 'Bucket name "%s" does not match regular expression %s' %
44 (bucket, BUCKET_NAME_REGEX.pattern)) 45 (bucket, BUCKET_NAME_REGEX.pattern))
OLDNEW
« no previous file with comments | « appengine/cr-buildbucket/api.py ('k') | appengine/cr-buildbucket/service.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698