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

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

Issue 10804036: Extensions Docs Server: Internationalized samples (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: encodings Created 8 years, 5 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 re 6 import re
6 import xml.dom.minidom as xml 7 import xml.dom.minidom as xml
7 8
8 from file_system import FileSystem 9 from file_system import FileSystem
9 from future import Future 10 from future import Future
10 11
11 class SubversionFileSystem(FileSystem): 12 class SubversionFileSystem(FileSystem):
12 """Class to fetch resources from src.chromium.org. 13 """Class to fetch resources from src.chromium.org.
13 """ 14 """
14 def __init__(self, fetcher): 15 def __init__(self, fetcher):
(...skipping 23 matching lines...) Expand all
38 return files 39 return files
39 40
40 def Get(self): 41 def Get(self):
41 for path, future in self._fetches: 42 for path, future in self._fetches:
42 result = future.Get() 43 result = future.Get()
43 if result.status_code == 404: 44 if result.status_code == 404:
44 self._value[path] = None 45 self._value[path] = None
45 elif path.endswith('/'): 46 elif path.endswith('/'):
46 self._value[path] = self._ListDir(result.content) 47 self._value[path] = self._ListDir(result.content)
47 else: 48 else:
48 self._value[path] = result.content 49 if os.path.splitext(path)[-1] in ['.js', '.html', '.json']:
not at google - send to devlin 2012/07/25 01:44:14 This is the same code as in LocalFileSystem. Pull
cduvall 2012/07/25 18:21:34 Done.
50 try:
51 self._value[path] = unicode(result.content, 'utf-8')
52 except:
53 self._value[path] = unicode(result.content, 'latin-1')
54 else:
55 self._value[path] = result.content
49 if self._error is not None: 56 if self._error is not None:
50 raise self._error 57 raise self._error
51 return self._value 58 return self._value
52 59
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698