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

Side by Side Diff: chrome/common/extensions/docs/server2/branch_utility.py

Issue 25627002: Docserver: when checking for the existence of an API on a branch, just look at (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
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
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__))
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
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
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/availability_finder.py ('k') | chrome/common/extensions/docs/server2/cron.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698