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 052abcd87031a42edb248916ed60b3ab62b04fe6..9277a41e129300a326c8e1c31426f2b8b932a1c5 100644 |
--- a/chrome/common/extensions/docs/server2/api_data_source.py |
+++ b/chrome/common/extensions/docs/server2/api_data_source.py |
@@ -171,16 +171,20 @@ class _APINodeCursor(object): |
return node_availability |
return None |
- def _LookupAvailability(self, lookup_path): |
+ def _LookupAvailability(self, lookup_path, no_assert=False): |
'''Runs all the lookup checks on self._lookup_path and |
returns the node availability if found, None otherwise. |
''' |
for lookup in (self._LookupNodeAvailability, |
self._CheckEventCallback, |
self._CheckNamespacePrefix): |
- node_availability = lookup(lookup_path) |
- if node_availability is not None: |
- return node_availability |
+ try: |
+ node_availability = lookup(lookup_path) |
+ if node_availability is not None: |
+ return node_availability |
+ except AssertionError: |
not at google - send to devlin
2014/07/10 16:28:48
Catching AssertionError is quite dangerous, becaus
|
+ if not no_assert: |
+ raise |
return None |
def _GetCategory(self): |
@@ -211,6 +215,17 @@ 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. |
+ ''' |
+ # HACK(ahernadez.miralles): Tacking on 'deprecated' to the lookup |
+ # path is a slight abuse of the lookup functions, which is why |
+ # assertions need to be ignored. However, this ensures that |
+ # we find when a node became deprecated, if it did at all. |
+ return self._LookupAvailability(self._lookup_path + ['deprecated'], |
+ no_assert=True) |
+ |
def GetAvailability(self): |
'''Returns availability information for this node. |
''' |
@@ -564,7 +579,10 @@ class _JSCModel(object): |
availability_info = self._current_node.GetAvailability() |
if availability_info is None: |
return None |
- status = availability_info.channel |
+ if self._current_node.GetDeprecated() is not None: |
+ status = 'deprecated' |
+ else: |
+ status = availability_info.channel |
version = availability_info.version |
return { |
'partial': self._template_cache.GetFromFile( |