OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 json | 5 import json |
6 import logging | 6 import logging |
7 import operator | 7 import operator |
8 | 8 |
9 from appengine_url_fetcher import AppEngineUrlFetcher | 9 from appengine_url_fetcher import AppEngineUrlFetcher |
10 import url_constants | 10 import url_constants |
(...skipping 12 matching lines...) Expand all Loading... | |
23 self.channel = channel | 23 self.channel = channel |
24 self.branch = branch | 24 self.branch = branch |
25 self.version = version | 25 self.version = version |
26 | 26 |
27 def __eq__(self, other): | 27 def __eq__(self, other): |
28 return self.__dict__ == other.__dict__ | 28 return self.__dict__ == other.__dict__ |
29 | 29 |
30 def __ne__(self, other): | 30 def __ne__(self, other): |
31 return not (self == other) | 31 return not (self == other) |
32 | 32 |
33 def __repr__(self): | |
34 return '%s%s' % (type(self).__name__, repr(self.__dict__)) | |
Jeffrey Yasskin
2013/10/02 00:19:17
Same comment as for LookupResult.
not at google - send to devlin
2013/10/02 00:40:02
Done.
| |
35 | |
36 def __str__(self): | |
37 return repr(self) | |
38 | |
33 | 39 |
34 class BranchUtility(object): | 40 class BranchUtility(object): |
35 '''Provides methods for working with Chrome channel, branch, and version | 41 '''Provides methods for working with Chrome channel, branch, and version |
36 data served from OmahaProxy. | 42 data served from OmahaProxy. |
37 ''' | 43 ''' |
38 | 44 |
39 def __init__(self, fetch_url, history_url, fetcher, object_store_creator): | 45 def __init__(self, fetch_url, history_url, fetcher, object_store_creator): |
40 self._fetcher = fetcher | 46 self._fetcher = fetcher |
41 def create_object_store(category): | 47 def create_object_store(category): |
42 return object_store_creator.Create(BranchUtility, category=category) | 48 return object_store_creator.Create(BranchUtility, category=category) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 version_json = json.loads(self._history_result.Get().content) | 221 version_json = json.loads(self._history_result.Get().content) |
216 latest_version = 0 | 222 latest_version = 0 |
217 for entry in version_json['events']: | 223 for entry in version_json['events']: |
218 version_title = entry['title'].split(' - ')[1].split('.') | 224 version_title = entry['title'].split(' - ')[1].split('.') |
219 version = int(version_title[0]) | 225 version = int(version_title[0]) |
220 if version > latest_version: | 226 if version > latest_version: |
221 latest_version = version | 227 latest_version = version |
222 | 228 |
223 self._version_object_store.Set('latest', latest_version) | 229 self._version_object_store.Set('latest', latest_version) |
224 return latest_version | 230 return latest_version |
OLD | NEW |