OLD | NEW |
---|---|
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 json | 6 import json |
7 | 7 |
8 class SidenavDataSource(object): | 8 class SidenavDataSource(object): |
9 """This class reads in and caches a JSON file representing the side navigation | 9 """This class reads in and caches a JSON file representing the side navigation |
10 menu. | 10 menu. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 self._QualifyHrefs(item['items']) | 63 self._QualifyHrefs(item['items']) |
64 | 64 |
65 href = item.get('href') | 65 href = item.get('href') |
66 if href is not None and not href.startswith(('http://', 'https://')): | 66 if href is not None and not href.startswith(('http://', 'https://')): |
67 if not href.startswith('/'): | 67 if not href.startswith('/'): |
68 logging.warn('Paths in sidenav must be qualified. %s is not.' % href) | 68 logging.warn('Paths in sidenav must be qualified. %s is not.' % href) |
69 href = '/' + href | 69 href = '/' + href |
70 item['href'] = '%s%s' % (self._file_dir, href) | 70 item['href'] = '%s%s' % (self._file_dir, href) |
71 | 71 |
72 def get(self, key): | 72 def get(self, key): |
73 sidenav_items = copy.deepcopy(self._cache.GetFromFile( | 73 sidenav = copy.deepcopy(self._cache.GetFromFile( |
74 '%s/%s_sidenav.json' % (self._json_path, key))) | 74 '%s/%s_sidenav.json' % (self._json_path, key))) |
75 self._AddSelected(sidenav) | 75 self._AddSelected(sidenav) |
not at google - send to devlin
2013/07/02 18:23:11
oops...? how did this happen.
jshumway
2013/07/24 17:40:07
Not sure, I think it was when I was updating the s
| |
76 self._QualifyHrefs(sidenav) | 76 self._QualifyHrefs(sidenav) |
77 return sidenav | 77 return sidenav |
OLD | NEW |