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

Unified Diff: chrome/common/extensions/docs/server2/file_system.py

Issue 10804036: Extensions Docs Server: Internationalized samples (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move logic into file_system 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/file_system.py
diff --git a/chrome/common/extensions/docs/server2/file_system.py b/chrome/common/extensions/docs/server2/file_system.py
index 34133d6f834ec460c2ca9b67fcae7ff81e433ddb..617d43ab2e4becc89d8f3ee46b78d2b1e70d2c95 100644
--- a/chrome/common/extensions/docs/server2/file_system.py
+++ b/chrome/common/extensions/docs/server2/file_system.py
@@ -2,6 +2,16 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os
+
+def _ProcessFileData(data, path):
+ if os.path.splitext(path)[-1] not in ['.js', '.html', '.json']:
+ return data
+ try:
+ return unicode(data, 'utf-8')
+ except:
+ return unicode(data, 'latin-1')
+
class FileSystem(object):
"""A FileSystem interface that can read files and directories.
"""
« no previous file with comments | « chrome/common/extensions/docs/server2/echo_handler.py ('k') | chrome/common/extensions/docs/server2/file_system_cache.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698