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

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

Issue 575613003: Docserver: Gitiles auth and cron refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/sidenav_data_source.py
diff --git a/chrome/common/extensions/docs/server2/sidenav_data_source.py b/chrome/common/extensions/docs/server2/sidenav_data_source.py
index b6bb82def221c1f7be5f8100a22b6c3db5455631..ca51aec51f648373b5b8292adee5896b20c388b4 100644
--- a/chrome/common/extensions/docs/server2/sidenav_data_source.py
+++ b/chrome/common/extensions/docs/server2/sidenav_data_source.py
@@ -24,13 +24,13 @@ def _AddLevels(items, level):
def _AddAnnotations(items, path, parent=None):
- '''Add 'selected', 'child_selected' and 'related' properties to
- |items| so that the sidenav can be expanded to show which menu item has
+ '''Add 'selected', 'child_selected' and 'related' properties to
+ |items| so that the sidenav can be expanded to show which menu item has
been selected and the related pages section can be drawn. 'related'
is added to all items with the same parent as the selected item.
- If more than one item exactly matches the path, the deepest one is considered
+ If more than one item exactly matches the path, the deepest one is considered
'selected'. A 'parent' property is added to the selected path.
-
+
Returns True if an item was marked 'selected'.
'''
for item in items:
@@ -42,12 +42,12 @@ def _AddAnnotations(items, path, parent=None):
if item.get('href', '') == path:
item['selected'] = True
if parent:
- item['parent'] = { 'title': parent.get('title', None),
+ item['parent'] = { 'title': parent.get('title', None),
'href': parent.get('href', None) }
-
+
for sibling in items:
sibling['related'] = True
-
+
return True
return False
@@ -92,13 +92,13 @@ class SidenavDataSource(DataSource):
href = href.lstrip('/')
item['href'] = self._server_instance.base_path + href
- def Cron(self):
+ def Refresh(self, path=None):
return self._cache.GetFromFile(
posixpath.join(JSON_TEMPLATES, 'chrome_sidenav.json'))
def get(self, key):
# TODO(mangini/kalman): Use |key| to decide which sidenav to use,
- # which will require a more complex Cron method.
+ # which will require a more complex Refresh method.
sidenav = self._cache.GetFromFile(
posixpath.join(JSON_TEMPLATES, 'chrome_sidenav.json')).Get()
sidenav = copy.deepcopy(sidenav)
« no previous file with comments | « chrome/common/extensions/docs/server2/servlet.py ('k') | chrome/common/extensions/docs/server2/sidenav_data_source_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698