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 49421a60f7dce381f57afb087093c8fe099cf006..4f66df76fd19e2dafe7bed4b7a6779edf3dd3bee 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 = 2 |
+_VERSION = 3 |
def _RemoveNoDocs(item): |
- if type(item) == dict: |
+ if isinstance(item, (dict, json_parse.OrderedDict)): |
if item.get('nodoc', False): |
not at google - send to devlin
2012/11/16 18:45:56
might be cleaner exposing like json_parse.IsDict(.
cduvall
2012/11/17 01:55:12
Done.
|
return True |
to_remove = [] |
@@ -274,10 +273,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) |
@@ -322,11 +321,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): |