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

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

Issue 1151283007: Docserver overhaul: Gitiles away from me. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove inform_users template to fix presubmit failure (it's now a redirect) Created 5 years, 6 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 copy 5 import copy
6 import logging 6 import logging
7 import posixpath 7 import posixpath
8 8
9 from compiled_file_system import Cache, SingleFile, Unicode 9 from compiled_file_system import Cache, SingleFile, Unicode
10 from data_source import DataSource 10 from data_source import DataSource
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 self._QualifyHrefs(item['items']) 85 self._QualifyHrefs(item['items'])
86 86
87 href = item.get('href') 87 href = item.get('href')
88 if href is not None and not href.startswith(('http://', 'https://')): 88 if href is not None and not href.startswith(('http://', 'https://')):
89 if not href.startswith('/'): 89 if not href.startswith('/'):
90 logging.warn('Paths in sidenav must be qualified. %s is not.' % href) 90 logging.warn('Paths in sidenav must be qualified. %s is not.' % href)
91 else: 91 else:
92 href = href.lstrip('/') 92 href = href.lstrip('/')
93 item['href'] = self._server_instance.base_path + href 93 item['href'] = self._server_instance.base_path + href
94 94
95 def Refresh(self, path=None): 95 def Refresh(self):
96 return self._cache.GetFromFile( 96 return self._cache.GetFromFile(
97 posixpath.join(JSON_TEMPLATES, 'chrome_sidenav.json')) 97 posixpath.join(JSON_TEMPLATES, 'chrome_sidenav.json'))
98 98
99 def get(self, key): 99 def get(self, key):
100 # TODO(mangini/kalman): Use |key| to decide which sidenav to use, 100 # TODO(mangini/kalman): Use |key| to decide which sidenav to use,
101 # which will require a more complex Refresh method. 101 # which will require a more complex Refresh method.
102 sidenav = self._cache.GetFromFile( 102 sidenav = self._cache.GetFromFile(
103 posixpath.join(JSON_TEMPLATES, 'chrome_sidenav.json')).Get() 103 posixpath.join(JSON_TEMPLATES, 'chrome_sidenav.json')).Get()
104 sidenav = copy.deepcopy(sidenav) 104 sidenav = copy.deepcopy(sidenav)
105 _AddAnnotations(sidenav, 105 _AddAnnotations(sidenav,
106 self._server_instance.base_path + self._request.path) 106 self._server_instance.base_path + self._request.path)
107 return sidenav 107 return sidenav
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/servlet.py ('k') | chrome/common/extensions/docs/server2/strings_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698