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

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

Issue 22339010: Docserver api dependencies no longer crash cron (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months 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
« no previous file with comments | « no previous file | no next file » | 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 logging 6 import logging
7 import os 7 import os
8 from collections import defaultdict, Mapping 8 from collections import defaultdict, Mapping
9 9
10 from branch_utility import BranchUtility 10 from branch_utility import BranchUtility
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 dependencies = feature.get('dependencies') 216 dependencies = feature.get('dependencies')
217 if dependencies is None: 217 if dependencies is None:
218 return [] 218 return []
219 219
220 def make_code_node(text): 220 def make_code_node(text):
221 return { 'class': 'code', 'text': text } 221 return { 'class': 'code', 'text': text }
222 222
223 permissions_content = [] 223 permissions_content = []
224 manifest_content = [] 224 manifest_content = []
225 225
226 for dependency in dependencies: 226 def categorize_dependency(dependency):
227 context, name = dependency.split(':', 1) 227 context, name = dependency.split(':', 1)
228 if context == 'permission': 228 if context == 'permission':
229 permissions_content.append(make_code_node('"%s"' % name)) 229 permissions_content.append(make_code_node('"%s"' % name))
230 elif context == 'manifest': 230 elif context == 'manifest':
231 manifest_content.append(make_code_node('"%s": {...}' % name)) 231 manifest_content.append(make_code_node('"%s": {...}' % name))
232 else: 232 elif context is not None:
not at google - send to devlin 2013/08/06 20:25:58 make it == 'app' so we continue to catch errors.
jshumway 2013/08/06 21:01:32 Ah, okay. (set it to 'api')
233 raise ValueError('Unrecognized dependency for %s: %s' 233 transitive_dependencies = (
234 % (self._namespace.name, context)) 234 self._api_features.get(context, {}).get('dependencies', []))
235 for transitive_dependency in transitive_dependencies:
236 categorize_dependency(transitive_dependency)
237
238 for dependency in dependencies:
239 categorize_dependency(dependency)
235 240
236 dependency_rows = [] 241 dependency_rows = []
237 if permissions_content: 242 if permissions_content:
238 dependency_rows.append({ 243 dependency_rows.append({
239 'title': 'Permissions', 244 'title': 'Permissions',
240 'content': permissions_content 245 'content': permissions_content
241 }) 246 })
242 if manifest_content: 247 if manifest_content:
243 dependency_rows.append({ 248 dependency_rows.append({
244 'title': 'Manifest', 249 'title': 'Manifest',
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 if self._disable_refs: 620 if self._disable_refs:
616 cache, ext = ( 621 cache, ext = (
617 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else 622 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else
618 (self._json_cache_no_refs, '.json')) 623 (self._json_cache_no_refs, '.json'))
619 else: 624 else:
620 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else 625 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else
621 (self._json_cache, '.json')) 626 (self._json_cache, '.json'))
622 return self._GenerateHandlebarContext( 627 return self._GenerateHandlebarContext(
623 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), 628 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)),
624 path) 629 path)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698