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

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

Issue 532903002: Docserver: Convert more future Get calls to Thens (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/new_github_file_system.py
diff --git a/chrome/common/extensions/docs/server2/new_github_file_system.py b/chrome/common/extensions/docs/server2/new_github_file_system.py
index 5aa1c2d9d82bdda36e22785ea0b893f16bcc0f52..98dd674758ea9f8ce6d44e75489b67a156ff59fc 100644
--- a/chrome/common/extensions/docs/server2/new_github_file_system.py
+++ b/chrome/common/extensions/docs/server2/new_github_file_system.py
@@ -178,9 +178,9 @@ class GithubFileSystem(FileSystem):
'''
github_future = self._fetcher.FetchAsync(
'zipball', username=username, password=password)
- def resolve():
+ def resolve(github_zip):
ahernandez 2014/09/03 19:16:07 Nit: more descriptive name, e.g. get_zip.
try:
- blob = github_future.Get().content
+ blob = github_zip.content
except urlfetch.DownloadError:
raise FileSystemError('Failed to download repo %s file from %s' %
(repo_key, repo_url))
@@ -194,7 +194,7 @@ class GithubFileSystem(FileSystem):
self._up_to_date_cache.Set(repo_key, True)
self._stat_cache.Set(repo_key, version)
return repo_zip
- return Future(callback=resolve)
+ return github_future.Then(resolve)
ahernandez 2014/09/03 19:12:37 Inline github_future.
# To decide whether we need to re-stat, and from there whether to re-fetch,
# make use of ObjectStore's start-empty configuration. If
@@ -246,8 +246,7 @@ class GithubFileSystem(FileSystem):
a list of filenames in that directory.
'''
self._EnsureRepoZip()
- def resolve():
- repo_zip = self._repo_zip.Get()
+ def resolve(repo_zip):
ahernandez 2014/09/03 19:16:07 Nit: choose a more descriptive name, e.g. read.
reads = {}
for path in paths:
if path not in repo_zip.Paths():
@@ -257,7 +256,7 @@ class GithubFileSystem(FileSystem):
else:
reads[path] = repo_zip.Read(path)
return reads
- return Future(callback=resolve)
+ return self._repo_zip.Then(resolve)
def Stat(self, path):
'''Stats |path| returning its version as as StatInfo object. If |path| ends

Powered by Google App Engine
This is Rietveld 408576698