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

Unified Diff: client/common_lib/base_job.py

Issue 6124004: Revert "Merge remote branch 'cros/upstream' into autotest-rebase" (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/common_lib/base_barrier_unittest.py ('k') | client/common_lib/base_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/common_lib/base_job.py
diff --git a/client/common_lib/base_job.py b/client/common_lib/base_job.py
index 4a2271c145a363b4c6cc0756a710ba08c632a57b..3c77d386680a161a886e925428756761aba74939 100644
--- a/client/common_lib/base_job.py
+++ b/client/common_lib/base_job.py
@@ -422,9 +422,6 @@ class status_log_entry(object):
TIMESTAMP_FIELD = 'timestamp'
LOCALTIME_FIELD = 'localtime'
- # non-space whitespace is forbidden in any fields
- BAD_CHAR_REGEX = re.compile(r'[\t\n\r\v\f]')
-
def __init__(self, status_code, subdir, operation, message, fields,
timestamp=None):
"""Construct a status.log entry.
@@ -442,16 +439,18 @@ class status_log_entry(object):
@raise ValueError: if any of the parameters are invalid
"""
+ # non-space whitespace is forbidden in any fields
+ bad_char_regex = r'[\t\n\r\v\f]'
if not log.is_valid_status(status_code):
raise ValueError('status code %r is not valid' % status_code)
self.status_code = status_code
- if subdir and self.BAD_CHAR_REGEX.search(subdir):
+ if subdir and re.search(bad_char_regex, subdir):
raise ValueError('Invalid character in subdir string')
self.subdir = subdir
- if operation and self.BAD_CHAR_REGEX.search(operation):
+ if operation and re.search(bad_char_regex, operation):
raise ValueError('Invalid character in operation string')
self.operation = operation
@@ -461,7 +460,7 @@ class status_log_entry(object):
message_lines = message.split('\n')
self.message = message_lines[0].replace('\t', ' ' * 8)
self.extra_message_lines = message_lines[1:]
- if self.BAD_CHAR_REGEX.search(self.message):
+ if re.search(bad_char_regex, self.message):
raise ValueError('Invalid character in message %r' % self.message)
if not fields:
@@ -469,7 +468,7 @@ class status_log_entry(object):
else:
self.fields = fields.copy()
for key, value in self.fields.iteritems():
- if self.BAD_CHAR_REGEX.search(key + value):
+ if re.search(bad_char_regex, key + value):
raise ValueError('Invalid character in %r=%r field'
% (key, value))
« no previous file with comments | « client/common_lib/base_barrier_unittest.py ('k') | client/common_lib/base_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698