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

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

Issue 23526077: [DocServer] Fixed Sample Links (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bumped Server's version Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | chrome/common/extensions/docs/static/js/samples.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server2/samples_data_source.py
diff --git a/chrome/common/extensions/docs/server2/samples_data_source.py b/chrome/common/extensions/docs/server2/samples_data_source.py
index 836cd5d9a562e1831460b26e42538fbb9bc29a2d..6ad828e7b0bce60981211632fe16ebba851abffa 100644
--- a/chrome/common/extensions/docs/server2/samples_data_source.py
+++ b/chrome/common/extensions/docs/server2/samples_data_source.py
@@ -6,6 +6,7 @@ import hashlib
import json
import logging
import re
+import traceback
from compiled_file_system import CompiledFileSystem
import third_party.json_schema_compiler.json_comment_eater as json_comment_eater
@@ -151,7 +152,6 @@ class SamplesDataSource(object):
icon_path = '%s/%s' % (icon_base, manifest_data['icon'])
manifest_data.update({
'icon': icon_path,
- 'id': hashlib.md5(url).hexdigest(),
'download_url': download_url,
'url': url,
'files': [f.replace(sample_path + '/', '') for f in sample_files],
@@ -173,6 +173,9 @@ class SamplesDataSource(object):
self._base_path = base_path
self._request = request
+ def _GetSampleId(self, sample_name):
+ return sample_name.lower().replace(' ', '-')
+
def _GetAcceptedLanguages(self):
accept_language = self._request.headers.get('Accept-Language', None)
if accept_language is None:
@@ -227,12 +230,14 @@ class SamplesDataSource(object):
locale_data = sample_data['locales'][locale]
sample_data['name'] = locale_data[name_key]['message']
sample_data['description'] = locale_data[description_key]['message']
+ sample_data['id'] = self._GetSampleId(sample_data['name'])
except Exception as e:
- logging.error(e)
+ logging.error(traceback.format_exc())
# Revert the sample to the original dict.
sample_data = dict_
return_list.append(sample_data)
else:
+ dict_['id'] = self._GetSampleId(name)
return_list.append(dict_)
return return_list
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | chrome/common/extensions/docs/static/js/samples.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698