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

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

Issue 63203002: Docserver: Make the hand-written Cron methods run first rather than last, since (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey Created 7 years, 1 month 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 | Annotate | Revision Log
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 7
8 from compiled_file_system import SingleFile 8 from compiled_file_system import SingleFile
9 from data_source import DataSource 9 from data_source import DataSource
10 from future import Gettable, Future 10 from future import Gettable, Future
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if not href.startswith('/'): 73 if not href.startswith('/'):
74 logging.warn('Paths in sidenav must be qualified. %s is not.' % href) 74 logging.warn('Paths in sidenav must be qualified. %s is not.' % href)
75 else: 75 else:
76 href = href.lstrip('/') 76 href = href.lstrip('/')
77 item['href'] = self._server_instance.base_path + href 77 item['href'] = self._server_instance.base_path + href
78 78
79 def Cron(self): 79 def Cron(self):
80 futures = [ 80 futures = [
81 self._cache.GetFromFile('%s/%s_sidenav.json' % (JSON_PATH, platform)) 81 self._cache.GetFromFile('%s/%s_sidenav.json' % (JSON_PATH, platform))
82 for platform in ('apps', 'extensions')] 82 for platform in ('apps', 'extensions')]
83 for future in futures: 83 return Future(delegate=Gettable(lambda: [f.Get() for f in futures]))
84 future.Get()
85 84
86 def get(self, key): 85 def get(self, key):
87 sidenav = copy.deepcopy(self._cache.GetFromFile( 86 sidenav = copy.deepcopy(self._cache.GetFromFile(
88 '%s/%s_sidenav.json' % (JSON_PATH, key)).Get()) 87 '%s/%s_sidenav.json' % (JSON_PATH, key)).Get())
89 _AddSelected(sidenav, self._server_instance.base_path + self._request.path) 88 _AddSelected(sidenav, self._server_instance.base_path + self._request.path)
90 return sidenav 89 return sidenav
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698