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

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

Issue 12230015: Fix unicode rendering of IDL files in the extension/apps developer server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 re 5 import re
6 import xml.dom.minidom as xml 6 import xml.dom.minidom as xml
7 from xml.parsers.expat import ExpatError 7 from xml.parsers.expat import ExpatError
8 8
9 import file_system 9 import file_system
10 from future import Future 10 from future import Future
(...skipping 14 matching lines...) Expand all
25 return files 25 return files
26 26
27 def Get(self): 27 def Get(self):
28 for path, future in self._fetches: 28 for path, future in self._fetches:
29 result = future.Get() 29 result = future.Get()
30 if result.status_code == 404: 30 if result.status_code == 404:
31 raise file_system.FileNotFoundError(path) 31 raise file_system.FileNotFoundError(path)
32 elif path.endswith('/'): 32 elif path.endswith('/'):
33 self._value[path] = self._ListDir(result.content) 33 self._value[path] = self._ListDir(result.content)
34 elif not self._binary: 34 elif not self._binary:
35 self._value[path] = file_system._ProcessFileData(result.content, path) 35 self._value[path] = file_system._ToUnicode(result.content)
36 else: 36 else:
37 self._value[path] = result.content 37 self._value[path] = result.content
38 if self._error is not None: 38 if self._error is not None:
39 raise self._error 39 raise self._error
40 return self._value 40 return self._value
41 41
42 class SubversionFileSystem(file_system.FileSystem): 42 class SubversionFileSystem(file_system.FileSystem):
43 """Class to fetch resources from src.chromium.org. 43 """Class to fetch resources from src.chromium.org.
44 """ 44 """
45 def __init__(self, fetcher, stat_fetcher): 45 def __init__(self, fetcher, stat_fetcher):
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 result = self._stat_fetcher.Fetch(directory + '/') 95 result = self._stat_fetcher.Fetch(directory + '/')
96 if result.status_code == 404: 96 if result.status_code == 404:
97 raise file_system.FileNotFoundError(path) 97 raise file_system.FileNotFoundError(path)
98 stat_info = self._CreateStatInfo(result.content) 98 stat_info = self._CreateStatInfo(result.content)
99 if not path.endswith('/'): 99 if not path.endswith('/'):
100 filename = path.rsplit('/', 1)[-1] 100 filename = path.rsplit('/', 1)[-1]
101 if filename not in stat_info.child_versions: 101 if filename not in stat_info.child_versions:
102 raise file_system.FileNotFoundError(path) 102 raise file_system.FileNotFoundError(path)
103 stat_info.version = stat_info.child_versions[filename] 103 stat_info.version = stat_info.child_versions[filename]
104 return stat_info 104 return stat_info
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698