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

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

Issue 255473003: docserver: Adds "API scheduled for Chrome version..." text to dev and beta APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleans up style Created 6 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
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
11 11
12 12
13 class ChannelInfo(object): 13 class ChannelInfo(object):
14 '''Represents a Chrome channel with three pieces of information. |channel| is 14 '''Represents a Chrome channel with three pieces of information. |channel| is
15 one of 'stable', 'beta', 'dev', or 'trunk'. |branch| and |version| correspond 15 one of 'stable', 'beta', 'dev', or 'trunk'. |branch| and |version| correspond
16 with each other, and represent different releases of Chrome. Note that 16 with each other, and represent different releases of Chrome. Note that
17 |branch| and |version| can occasionally be the same for separate channels 17 |branch| and |version| can occasionally be the same for separate channels
18 (i.e. 'beta' and 'dev'), so all three fields are required to uniquely 18 (i.e. 'beta' and 'dev'), so all three fields are required to uniquely
19 identify a channel. 19 identify a channel.
20 ''' 20 '''
21 21
22 def __init__(self, channel, branch, version): 22 def __init__(self, channel, branch, version, scheduled=None):
23 assert isinstance(channel, basestring), channel 23 assert isinstance(channel, basestring), channel
24 assert isinstance(branch, basestring), branch 24 assert isinstance(branch, basestring), branch
25 # TODO(kalman): Assert that this is a string. One day Chromium will probably 25 # TODO(kalman): Assert that this is a string. One day Chromium will probably
26 # be served out of a git repository and the versions will no longer be ints. 26 # be served out of a git repository and the versions will no longer be ints.
27 assert isinstance(version, int) or version == 'trunk', version 27 assert isinstance(version, int) or version == 'trunk', version
28 self.channel = channel 28 self.channel = channel
29 self.branch = branch 29 self.branch = branch
30 self.version = version 30 self.version = version
31 self.scheduled = scheduled
not at google - send to devlin 2014/04/25 23:15:58 this isn't really the right place for this. Channe
31 32
32 def __eq__(self, other): 33 def __eq__(self, other):
33 return self.__dict__ == other.__dict__ 34 return self.__dict__ == other.__dict__
34 35
35 def __ne__(self, other): 36 def __ne__(self, other):
36 return not (self == other) 37 return not (self == other)
37 38
38 def __repr__(self): 39 def __repr__(self):
39 return '%s%s' % (type(self).__name__, repr(self.__dict__)) 40 return '%s%s' % (type(self).__name__, repr(self.__dict__))
40 41
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 version_json = json.loads(self._history_result.Get().content) 229 version_json = json.loads(self._history_result.Get().content)
229 latest_version = 0 230 latest_version = 0
230 for entry in version_json['events']: 231 for entry in version_json['events']:
231 version_title = entry['title'].split(' - ')[1].split('.') 232 version_title = entry['title'].split(' - ')[1].split('.')
232 version = int(version_title[0]) 233 version = int(version_title[0])
233 if version > latest_version: 234 if version > latest_version:
234 latest_version = version 235 latest_version = version
235 236
236 self._version_object_store.Set('latest', latest_version) 237 self._version_object_store.Set('latest', latest_version)
237 return latest_version 238 return latest_version
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698