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

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

Issue 54603010: Docserver: Implement the content providers infrastructure, where a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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/redirector.py
diff --git a/chrome/common/extensions/docs/server2/redirector.py b/chrome/common/extensions/docs/server2/redirector.py
index 0a38efd91d8e08ab293bfab96a992c5eb6619313..c5e36353b6397996f5b8662480a409a913b401fc 100644
--- a/chrome/common/extensions/docs/server2/redirector.py
+++ b/chrome/common/extensions/docs/server2/redirector.py
@@ -8,8 +8,7 @@ from urlparse import urlsplit
from file_system import FileNotFoundError
class Redirector(object):
- def __init__(self, compiled_fs_factory, file_system, root_path):
- self._root_path = root_path
+ def __init__(self, compiled_fs_factory, file_system):
self._file_system = file_system
self._cache = compiled_fs_factory.ForJson(file_system)
@@ -31,7 +30,7 @@ class Redirector(object):
try:
rules = self._cache.GetFromFile(
- posixpath.join(self._root_path, dirname, 'redirects.json')).Get()
+ posixpath.join(dirname, 'redirects.json')).Get()
except FileNotFoundError:
return None
@@ -42,7 +41,7 @@ class Redirector(object):
urlsplit(redirect).scheme in ('http', 'https')):
return redirect
- return posixpath.normpath('/' + posixpath.join(dirname, redirect))
+ return posixpath.normpath(posixpath.join('/', dirname, redirect))
def _RedirectOldHosts(self, host, path):
''' Redirect paths from the old code.google.com to the new
@@ -61,7 +60,6 @@ class Redirector(object):
def Cron(self):
''' Load files during a cron run.
'''
- for root, dirs, files in self._file_system.Walk(self._root_path):
+ for root, dirs, files in self._file_system.Walk(''):
if 'redirects.json' in files:
- self._cache.GetFromFile('%s/redirects.json' % posixpath.join(
- self._root_path, root).rstrip('/')).Get()
+ self._cache.GetFromFile(posixpath.join(root, 'redirects.json')).Get()
« no previous file with comments | « chrome/common/extensions/docs/server2/cron_servlet_test.py ('k') | chrome/common/extensions/docs/server2/redirector_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698