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..6bb74d10ddad70bafaf2e5e1723cfbd46186d4c7 100644 |
| --- a/chrome/common/extensions/docs/server2/local_fetcher.py |
| +++ b/chrome/common/extensions/docs/server2/local_fetcher.py |
| @@ -4,6 +4,17 @@ |
| import os |
| +def _MakeSubversionDir(path): |
| + """This function is necessary to make the output of a LocalFetcher match what |
| + a SubversionFetcher would give. |
|
not at google - send to devlin
2012/07/11 00:35:09
I think this will be unnecessary if listing files
cduvall
2012/07/11 20:56:30
Done.
|
| + """ |
| + page = '<title>Local ' + os.path.join(*path.split('/')) + '</title>' |
| + for filename in os.listdir(path): |
| + if os.path.isdir(os.path.join(path, filename)): |
| + filename += '/' |
| + page += '\n<a>' + filename + '</a>' |
| + return page |
| + |
| class LocalFetcher(object): |
| """Class to fetch resources from local filesystem. |
| """ |
| @@ -22,6 +33,8 @@ class LocalFetcher(object): |
| def _ReadFile(self, filename): |
| path = os.path.join(self._base_path, filename) |
| + if os.path.isdir(path): |
| + return _MakeSubversionDir(path) |
| with open(path, 'r') as f: |
| return f.read() |