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

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: Add test 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
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_data_source_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aaea1ab2a1e50fa4b28bc6fb70cf8be6624ab855..247db869afd0e9137b5d133284b5a313a5ed1ed6 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,21 @@ 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
+ # Check for this before calling CheckEventCallback to avoid
+ # unnecessary AssertionErrors.
not at google - send to devlin 2014/07/15 21:51:15 comment is unnecessary, code is clear enough
+ if 'callback' in self._lookup_path:
+ return self._CheckEventCallback(deprecated_path)
+
def GetAvailability(self):
'''Returns availability information for this node.
'''
@@ -222,6 +237,15 @@ class _APINodeCursor(object):
logging.warning('No availability found for: %s' % self)
return None
+ # Check this before checking parent availability; we always want
not at google - send to devlin 2014/07/15 21:51:15 I'd rather that the callers worry about this rathe
+ # to see when an API became deprecated.
+ deprecated_availability = self.GetDeprecated()
+ if deprecated_availability is not None:
+ # The same annotation object is used for multiple nodes.
+ deprecated_info = copy(deprecated_availability)
+ deprecated_info.channel = 'deprecated'
+ return deprecated_info
+
parent_node_availability = self._LookupAvailability(self._GetParentPath())
# If the parent node availability couldn't be found, something
# is very wrong.
« 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