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

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: Addressed kalman's feedback 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
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..b38cc03ce82a99a86d80751d69b6bea9496e40ae 100644
--- a/chrome/common/extensions/docs/server2/samples_data_source.py
+++ b/chrome/common/extensions/docs/server2/samples_data_source.py
@@ -151,7 +151,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 +172,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 +229,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)
not at google - send to devlin 2013/09/23 15:59:51 incremental cleanup: except: logging.error(trac
François Beaufort 2013/09/24 09:24:49 Done.
# 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

Powered by Google App Engine
This is Rietveld 408576698