Chromium Code Reviews| 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): |
|
not at google - send to devlin
2012/07/12 00:22:48
Could you make recursive an optional parameter, de
cduvall
2012/07/12 01:51:23
Done.
|
| + 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. |
|
not at google - send to devlin
2012/07/12 00:22:48
This is the kind of contract that should be docume
cduvall
2012/07/12 01:51:23
Done.
|
| + 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 |