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

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

Issue 14247024: Devserver: allow SubversionFileSystem to be pinned to a specific rev on construction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 from future import Future 7 from future import Future
8 8
9 class _Response(object): 9 class _Response(object):
10 def __init__(self): 10 def __init__(self):
(...skipping 20 matching lines...) Expand all
31 if filename.startswith('.'): 31 if filename.startswith('.'):
32 continue 32 continue
33 if os.path.isdir(os.path.join(self._base_path, directory, filename)): 33 if os.path.isdir(os.path.join(self._base_path, directory, filename)):
34 html += '<a>' + filename + '/</a>\n' 34 html += '<a>' + filename + '/</a>\n'
35 else: 35 else:
36 html += '<a>' + filename + '</a>\n' 36 html += '<a>' + filename + '</a>\n'
37 html += '</html>' 37 html += '</html>'
38 return html 38 return html
39 39
40 def FetchAsync(self, url): 40 def FetchAsync(self, url):
41 url = url.rsplit('?', 1)[0]
41 return Future(value=self.Fetch(url)) 42 return Future(value=self.Fetch(url))
42 43
43 def Fetch(self, url): 44 def Fetch(self, url):
45 url = url.rsplit('?', 1)[0]
44 result = _Response() 46 result = _Response()
45 if url.endswith('/'): 47 if url.endswith('/'):
46 result.content = self._ListDir(url) 48 result.content = self._ListDir(url)
47 else: 49 else:
48 result.content = self._ReadFile(url) 50 result.content = self._ReadFile(url)
49 return result 51 return result
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/fake_fetchers.py ('k') | chrome/common/extensions/docs/server2/file_system.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698