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

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

Issue 10894049: Make links to samples and re-enable sample list for api references. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: patch'd Created 8 years, 3 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
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 hashlib
5 import json 6 import json
6 import logging 7 import logging
7 import re 8 import re
8 9
9 import compiled_file_system as compiled_fs 10 import compiled_file_system as compiled_fs
10 import third_party.json_schema_compiler.json_comment_eater as json_comment_eater 11 import third_party.json_schema_compiler.json_comment_eater as json_comment_eater
11 import third_party.json_schema_compiler.model as model 12 import third_party.json_schema_compiler.model as model
12 import url_constants 13 import url_constants
13 14
14 DEFAULT_ICON_PATH = '/images/sample-default-icon.png' 15 DEFAULT_ICON_PATH = '/images/sample-default-icon.png'
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 url = sample_base_path 131 url = sample_base_path
131 icon_base = sample_base_path 132 icon_base = sample_base_path
132 download_url = sample_base_path + '.zip' 133 download_url = sample_base_path + '.zip'
133 134
134 if manifest_data['icon'] is None: 135 if manifest_data['icon'] is None:
135 icon_path = self._static_path + DEFAULT_ICON_PATH 136 icon_path = self._static_path + DEFAULT_ICON_PATH
136 else: 137 else:
137 icon_path = icon_base + '/' + manifest_data['icon'] 138 icon_path = icon_base + '/' + manifest_data['icon']
138 manifest_data.update({ 139 manifest_data.update({
139 'icon': icon_path, 140 'icon': icon_path,
141 'id': hashlib.md5(url).hexdigest(),
140 'download_url': download_url, 142 'download_url': download_url,
141 'url': url, 143 'url': url,
142 'files': [f.replace(sample_path + '/', '') for f in sample_files], 144 'files': [f.replace(sample_path + '/', '') for f in sample_files],
143 'api_calls': api_calls 145 'api_calls': api_calls
144 }) 146 })
145 samples_list.append(manifest_data) 147 samples_list.append(manifest_data)
146 148
147 return samples_list 149 return samples_list
148 150
149 def __init__(self, extensions_cache, apps_cache, samples_path, request): 151 def __init__(self, extensions_cache, apps_cache, samples_path, request):
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return return_list 216 return return_list
215 217
216 def __getitem__(self, key): 218 def __getitem__(self, key):
217 return self.get(key) 219 return self.get(key)
218 220
219 def get(self, key): 221 def get(self, key):
220 return { 222 return {
221 'apps': lambda: self._CreateSamplesDict('apps'), 223 'apps': lambda: self._CreateSamplesDict('apps'),
222 'extensions': lambda: self._CreateSamplesDict('extensions') 224 'extensions': lambda: self._CreateSamplesDict('extensions')
223 }.get(key, lambda: {})() 225 }.get(key, lambda: {})()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698