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

Unified Diff: chrome/common/extensions/docs/server2/api_data_source.py

Issue 386443003: Docserver: Add 'deprecated since' message for API nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
Index: chrome/common/extensions/docs/server2/api_data_source.py
diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py
index 91dcfc34ba3a8447d37c0dff1fd74e29cf12307f..86a3bb81b4d999950729e8b77f453fb3c61f2209 100644
--- a/chrome/common/extensions/docs/server2/api_data_source.py
+++ b/chrome/common/extensions/docs/server2/api_data_source.py
@@ -171,7 +171,7 @@ class _APINodeCursor(object):
return None
def _LookupAvailability(self, lookup_path):
- '''Runs all the lookup checks on self._lookup_path and
+ '''Runs all the lookup checks on |lookup_path| and
returns the node availability if found, None otherwise.
'''
for lookup in (self._LookupNodeAvailability,
@@ -210,6 +210,19 @@ class _APINodeCursor(object):
return 'properties'
raise AssertionError('Could not classify node %s' % self)
+ def GetDeprecated(self):
+ '''Returns when this node became deprecated, or None if it
+ is not deprecated.
+ '''
+ deprecated_path = self._lookup_path + ['deprecated']
+ for lookup in (self._LookupNodeAvailability,
+ self._CheckNamespacePrefix):
+ node_availability = lookup(deprecated_path)
+ if node_availability is not None:
+ return node_availability
+ if 'callback' in self._lookup_path:
+ return self._CheckEventCallback(deprecated_path)
not at google - send to devlin 2014/07/17 20:30:06 'return None' at end.
+
def GetAvailability(self):
'''Returns availability information for this node.
'''
@@ -560,11 +573,16 @@ class _JSCModel(object):
information.
'''
if status is None:
- availability_info = self._current_node.GetAvailability()
- if availability_info is None:
- return None
- status = availability_info.channel
- version = availability_info.version
+ availability_info = self._current_node.GetDeprecated()
not at google - send to devlin 2014/07/17 20:30:06 please add a comment like 'Displaying deprecated s
+ if availability_info is not None:
+ status = 'deprecated'
+ else:
+ availability_info = self._current_node.GetAvailability()
+ if availability_info is None:
+ return None
+ status = availability_info.channel_info.channel
+ version = availability_info.channel_info.version
+ scheduled = availability_info.scheduled
return {
'partial': self._template_cache.GetFromFile(
'%sintro_tables/%s_message.html' % (PRIVATE_TEMPLATES, status)).Get(),

Powered by Google App Engine
This is Rietveld 408576698