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 36d378073149634dc9430ea31df9b4021d36cc78..a56e8183f92bc0e3da1f90c7b027bb138fd97f77 100644 |
--- a/chrome/common/extensions/docs/server2/api_data_source.py |
+++ b/chrome/common/extensions/docs/server2/api_data_source.py |
@@ -3,13 +3,12 @@ |
# found in the LICENSE file. |
import copy |
-import json |
import os |
from docs_server_utils import GetLinkToRefType |
import compiled_file_system as compiled_fs |
from file_system import FileNotFoundError |
-import third_party.json_schema_compiler.json_comment_eater as json_comment_eater |
+import third_party.json_schema_compiler.json_parse as json_parse |
import third_party.json_schema_compiler.model as model |
import third_party.json_schema_compiler.idl_schema as idl_schema |
import third_party.json_schema_compiler.idl_parser as idl_parser |
@@ -17,10 +16,10 @@ import third_party.json_schema_compiler.idl_parser as idl_parser |
# Increment this version when there are changes to the data stored in any of |
# the caches used by APIDataSource. This allows the cache to be invalidated |
# without having to flush memcache on the production server. |
-_VERSION = 0 |
+_VERSION = 1 |
def _RemoveNoDocs(item): |
- if type(item) == dict: |
+ if isinstance(item, (dict, json_parse.OrderedDict)): |
if item.get('nodoc', False): |
return True |
for key, value in item.items(): |
@@ -262,10 +261,10 @@ class APIDataSource(object): |
self._samples_factory.Create(request)) |
def _LoadPermissions(self, json_str): |
- return json.loads(json_comment_eater.Nom(json_str)) |
+ return json_parse.Parse(json_str) |
def _LoadJsonAPI(self, api): |
- return _JscModel(json.loads(json_comment_eater.Nom(api))[0]) |
+ return _JscModel(json_parse.Parse(api)[0]) |
def _LoadIdlAPI(self, api): |
idl = idl_parser.IDLParser().ParseData(api) |
@@ -310,11 +309,9 @@ class APIDataSource(object): |
return api_perms |
def _GenerateHandlebarContext(self, handlebar, path): |
- return_dict = { |
- 'permissions': self._GetFeature(path), |
- 'samples': _LazySamplesGetter(path, self._samples) |
- } |
- return_dict.update(handlebar.ToDict()) |
+ return_dict = handlebar.ToDict() |
+ return_dict['permissions'] = self._GetFeature(path) |
+ return_dict['samples'] = _LazySamplesGetter(path, self._samples) |
return return_dict |
def __getitem__(self, key): |