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

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

Issue 10500004: Die build.py, Die: Part 2 (LocalFetcher, Handlebar support, build script) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added parens Created 8 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import logging
6 import os
7
8 class LocalFetcher(object):
9 """Class to fetch resources from local filesystem.
10 """
11 def __init__(self, base_path):
12 self.base_path = base_path
13
14 class _Resource(object):
15 def __init__(self):
16 self.content = ''
17 self.headers = {}
18
19 def _ReadFile(self, filename):
20 with open(filename, 'r') as f:
21 return f.read()
22
23 def FetchResource(self, branch, path):
24 real_path = os.path.join(*path.split('/'))
25 result = self._Resource()
26 logging.info('Reading: ' + os.path.join(self.base_path, real_path))
27 result.content = self._ReadFile(os.path.join(self.base_path, real_path))
28 return result
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/echo_handler.py ('k') | chrome/common/extensions/docs/server2/local_fetcher_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698