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

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

Issue 11079010: Extensions Docs Server: Preserve JSON declaration order in extensions documentation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated with the new simplejson Created 8 years, 1 month 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 a3f1b2a8ab3e60b31b2e821a0714a49014ccd345..1095b307edf65afb347fd83660ed8f29f8146e87 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 logging
import os
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 = 3
+_VERSION = 4
def _RemoveNoDocs(item):
- if type(item) == dict:
+ if json_parse.IsDict(item):
if item.get('nodoc', False):
return True
to_remove = []
@@ -334,11 +333,11 @@ class APIDataSource(object):
disable_refs)
def _LoadPermissions(self, json_str):
- return json.loads(json_comment_eater.Nom(json_str))
+ return json_parse.Parse(json_str)
def _LoadJsonAPI(self, api, disable_refs):
return _JSCModel(
- json.loads(json_comment_eater.Nom(api))[0],
+ json_parse.Parse(api)[0],
self._ref_resolver_factory.Create() if not disable_refs else None,
disable_refs).ToDict()
@@ -404,12 +403,9 @@ class APIDataSource(object):
return api_perms
def _GenerateHandlebarContext(self, handlebar_dict, path):
- return_dict = {
- 'permissions': self._GetFeature(path),
- 'samples': _LazySamplesGetter(path, self._samples)
- }
- return_dict.update(handlebar_dict)
- return return_dict
+ handlebar_dict['permissions'] = self._GetFeature(path)
+ handlebar_dict['samples'] = _LazySamplesGetter(path, self._samples)
+ return handlebar_dict
def _GetAsSubdirectory(self, name):
if name.startswith('experimental_'):
« 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