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

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

Issue 10689144: Extensions Docs Server: Samples zip files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Samples page with full links and descriptions Created 8 years, 5 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/local_fetcher.py
diff --git a/chrome/common/extensions/docs/server2/local_fetcher.py b/chrome/common/extensions/docs/server2/local_fetcher.py
index 88b8389ad9642549419cfc7122562cc1c51a5594..02c236cede4d2b5ba305bbb20a97b162cf4d8519 100644
--- a/chrome/common/extensions/docs/server2/local_fetcher.py
+++ b/chrome/common/extensions/docs/server2/local_fetcher.py
@@ -25,6 +25,20 @@ class LocalFetcher(object):
with open(path, 'r') as f:
return f.read()
+ def FetchDirectory(self, directory):
+ all_files = []
+ for path, subdirs, files in os.walk(
+ os.path.join(self._base_path, self._ConvertToFilepath(directory))):
+ for filename in files:
+ full_path = os.path.join(path, filename)
+ if os.path.isdir(full_path):
+ all_files.append(full_path + '/')
+ else:
+ all_files.append(full_path)
+ # Remove |_base_path| from files before returning.
+ return self._Response(
+ map(lambda x: x.replace(self._base_path + os.sep, ''), all_files))
+
def FetchResource(self, path):
# A response object is returned to match the behavior of urlfetch.
# See: developers.google.com/appengine/docs/python/urlfetch/responseobjects

Powered by Google App Engine
This is Rietveld 408576698