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

Side by Side Diff: chrome/common/extensions/docs/server2/api_data_source.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: Adds style changes and rebase Created 6 years, 7 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 | « no previous file | chrome/common/extensions/docs/server2/api_data_source_test.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 (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 from copy import copy 5 from copy import copy
6 import logging 6 import logging
7 import os 7 import os
8 import posixpath 8 import posixpath
9 9
10 from data_source import DataSource 10 from data_source import DataSource
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 as_dict['deprecated'] = self._namespace.deprecated 112 as_dict['deprecated'] = self._namespace.deprecated
113 113
114 as_dict['byName'] = _GetByNameDict(as_dict) 114 as_dict['byName'] = _GetByNameDict(as_dict)
115 return as_dict 115 return as_dict
116 116
117 def _GetApiAvailability(self): 117 def _GetApiAvailability(self):
118 return self._availability_finder.GetApiAvailability(self._namespace.name) 118 return self._availability_finder.GetApiAvailability(self._namespace.name)
119 119
120 def _GetChannelWarning(self): 120 def _GetChannelWarning(self):
121 if not self._IsExperimental(): 121 if not self._IsExperimental():
122 return { self._GetApiAvailability().channel: True } 122 return { self._GetApiAvailability().channel_info.channel: True }
123 return None 123 return None
124 124
125 def _IsExperimental(self): 125 def _IsExperimental(self):
126 return self._namespace.name.startswith('experimental') 126 return self._namespace.name.startswith('experimental')
127 127
128 def _GenerateTypes(self, types): 128 def _GenerateTypes(self, types):
129 return [self._GenerateType(t) for t in types] 129 return [self._GenerateType(t) for t in types]
130 130
131 def _GenerateType(self, type_): 131 def _GenerateType(self, type_):
132 type_dict = { 132 type_dict = {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 { 'text': self._namespace.description } 344 { 'text': self._namespace.description }
345 ] 345 ]
346 } 346 }
347 347
348 def _GetIntroAvailabilityRow(self): 348 def _GetIntroAvailabilityRow(self):
349 ''' Generates the 'Availability' row data for an API intro table. 349 ''' Generates the 'Availability' row data for an API intro table.
350 ''' 350 '''
351 if self._IsExperimental(): 351 if self._IsExperimental():
352 status = 'experimental' 352 status = 'experimental'
353 version = None 353 version = None
354 scheduled = None
354 else: 355 else:
355 availability = self._GetApiAvailability() 356 availability = self._GetApiAvailability()
356 status = availability.channel 357 status = availability.channel_info.channel
357 version = availability.version 358 version = availability.channel_info.version
359 scheduled = availability.scheduled
358 return { 360 return {
359 'title': 'Availability', 361 'title': 'Availability',
360 'content': [{ 362 'content': [{
361 'partial': self._template_cache.GetFromFile( 363 'partial': self._template_cache.GetFromFile(
362 posixpath.join(PRIVATE_TEMPLATES, 364 posixpath.join(PRIVATE_TEMPLATES,
363 'intro_tables', 365 'intro_tables',
364 '%s_message.html' % status)).Get(), 366 '%s_message.html' % status)).Get(),
365 'version': version 367 'version': version,
368 'scheduled': scheduled
366 }] 369 }]
367 } 370 }
368 371
369 def _GetIntroDependencyRows(self): 372 def _GetIntroDependencyRows(self):
370 # Devtools aren't in _api_features. If we're dealing with devtools, bail. 373 # Devtools aren't in _api_features. If we're dealing with devtools, bail.
371 if 'devtools' in self._namespace.name: 374 if 'devtools' in self._namespace.name:
372 return [] 375 return []
373 376
374 api_feature = self._api_features.Get().get(self._namespace.name) 377 api_feature = self._api_features.Get().get(self._namespace.name)
375 if not api_feature: 378 if not api_feature:
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 self._samples) 522 self._samples)
520 return handlebar_dict 523 return handlebar_dict
521 return Future(callback=resolve) 524 return Future(callback=resolve)
522 525
523 def get(self, api_name): 526 def get(self, api_name):
524 return self._GetImpl(api_name).Get() 527 return self._GetImpl(api_name).Get()
525 528
526 def Cron(self): 529 def Cron(self):
527 futures = [self._GetImpl(name) for name in self._api_models.GetNames()] 530 futures = [self._GetImpl(name) for name in self._api_models.GetNames()]
528 return Collect(futures, except_pass=FileNotFoundError) 531 return Collect(futures, except_pass=FileNotFoundError)
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_data_source_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698