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

Side by Side Diff: trunk/src/chrome/common/extensions/docs/server2/api_data_source.py

Issue 47403003: Revert 231982 "Docserver: Display enum value descriptions in API..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/chrome/common/extensions/docs/server2/app.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import json 6 import json
7 import logging 7 import logging
8 import os 8 import os
9 from collections import defaultdict, Mapping 9 from collections import defaultdict, Mapping
10 10
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 dst_dict['choices'] = self._GenerateTypes(type_.choices) 319 dst_dict['choices'] = self._GenerateTypes(type_.choices)
320 # We keep track of which == last for knowing when to add "or" between 320 # We keep track of which == last for knowing when to add "or" between
321 # choices in templates. 321 # choices in templates.
322 if len(dst_dict['choices']) > 0: 322 if len(dst_dict['choices']) > 0:
323 dst_dict['choices'][-1]['last'] = True 323 dst_dict['choices'][-1]['last'] = True
324 elif type_.property_type == model.PropertyType.REF: 324 elif type_.property_type == model.PropertyType.REF:
325 dst_dict['link'] = self._GetLink(type_.ref_type) 325 dst_dict['link'] = self._GetLink(type_.ref_type)
326 elif type_.property_type == model.PropertyType.ARRAY: 326 elif type_.property_type == model.PropertyType.ARRAY:
327 dst_dict['array'] = self._GenerateType(type_.item_type) 327 dst_dict['array'] = self._GenerateType(type_.item_type)
328 elif type_.property_type == model.PropertyType.ENUM: 328 elif type_.property_type == model.PropertyType.ENUM:
329 dst_dict['enum_values'] = [ 329 dst_dict['enum_values'] = []
330 {'name': value.name, 'description': value.description} 330 for enum_value in type_.enum_values:
331 for value in type_.enum_values] 331 dst_dict['enum_values'].append({'name': enum_value})
332 if len(dst_dict['enum_values']) > 0: 332 if len(dst_dict['enum_values']) > 0:
333 dst_dict['enum_values'][-1]['last'] = True 333 dst_dict['enum_values'][-1]['last'] = True
334 elif type_.instance_of is not None: 334 elif type_.instance_of is not None:
335 dst_dict['simple_type'] = type_.instance_of.lower() 335 dst_dict['simple_type'] = type_.instance_of.lower()
336 else: 336 else:
337 dst_dict['simple_type'] = type_.property_type.name.lower() 337 dst_dict['simple_type'] = type_.property_type.name.lower()
338 338
339 def _GetIntroTableList(self): 339 def _GetIntroTableList(self):
340 '''Create a generic data structure that can be traversed by the templates 340 '''Create a generic data structure that can be traversed by the templates
341 to create an API intro table. 341 to create an API intro table.
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 649
650 if self._disable_refs: 650 if self._disable_refs:
651 cache, ext = ( 651 cache, ext = (
652 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else 652 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else
653 (self._json_cache_no_refs, '.json')) 653 (self._json_cache_no_refs, '.json'))
654 else: 654 else:
655 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else 655 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else
656 (self._json_cache, '.json')) 656 (self._json_cache, '.json'))
657 return self._GenerateHandlebarContext( 657 return self._GenerateHandlebarContext(
658 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)).Get()) 658 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)).Get())
OLDNEW
« no previous file with comments | « no previous file | trunk/src/chrome/common/extensions/docs/server2/app.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698