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

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

Issue 10704252: Extensions Docs Server: Internal file system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed up 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/subversion_fetcher.py
diff --git a/chrome/common/extensions/docs/server2/subversion_fetcher.py b/chrome/common/extensions/docs/server2/subversion_fetcher.py
deleted file mode 100644
index 803381bf052223edd14cdf254fff144f2cfa07ad..0000000000000000000000000000000000000000
--- a/chrome/common/extensions/docs/server2/subversion_fetcher.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import xml.dom.minidom as xml
-
-SUBVERSION_URL = 'http://src.chromium.org/chrome'
-TRUNK_URL = SUBVERSION_URL + '/trunk'
-BRANCH_URL = SUBVERSION_URL + '/branches'
-
-class SubversionFetcher(object):
- """Class to fetch resources from src.chromium.org.
- """
- def __init__(self, branch, base_path, url_fetcher):
- self._base_path = self._GetURLFromBranch(branch) + '/' + base_path
- self._url_fetcher = url_fetcher
-
- def _GetURLFromBranch(self, branch):
- if branch == 'trunk':
- return TRUNK_URL + '/src'
- return BRANCH_URL + '/' + branch + '/src'
-
- def _ListDir(self, directory):
- dom = xml.parseString(directory)
- files = [elem.childNodes[0].data for elem in dom.getElementsByTagName('a')]
- if '..' in files:
- files.remove('..')
- return files
-
- def _RecursiveList(self, files, base):
- all_files = []
- for filename in files:
- if filename.endswith('/'):
- dir_name = base + '/' + filename.split('/')[-2]
- all_files.extend(self.ListDirectory(dir_name, True).content)
- else:
- all_files.append(base + '/' + filename)
- return all_files
-
- def ListDirectory(self, path, recursive=False):
- result = self._url_fetcher.fetch(self._base_path + '/' + path)
- result.content = self._ListDir(result.content)
- if recursive:
- result.content = self._RecursiveList(result.content, path)
- return result
-
- def FetchResource(self, path):
- return self._url_fetcher.fetch(self._base_path + '/' + path)
-

Powered by Google App Engine
This is Rietveld 408576698