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

Unified Diff: server/scripts/redirector.py

Issue 1334323003: fix a bug with redirects (Closed) Base URL: git@github.com:dart-lang/api.dartlang.org.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « server/app.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/scripts/redirector.py
diff --git a/server/scripts/redirector.py b/server/scripts/redirector.py
index e379228d1e0b3ee230fc52696674cee7d25b239c..c1f42a8822ae6b30db9f0cad8a2a9c42cae4e07c 100644
--- a/server/scripts/redirector.py
+++ b/server/scripts/redirector.py
@@ -18,7 +18,7 @@ ONE_WEEK = ONE_DAY * 7
# for redirects below
ONLY_DART_LIB = re.compile("^dart:([a-zA-Z0-9_]+)$")
-LIB_NAME_AND_CLASS_NAME = re.compile("^dart:([^\.]+)\.(.+)$")
+LIB_NAME_AND_CLASS_NAME = re.compile("^dart[:-]([^\.]+)\.(.+)$")
class VersionInfo(object):
"""Small helper class holding information about the last version seen and the
@@ -265,7 +265,7 @@ def redir_be_path(handler, *args, **kwargs):
# /apidocs/channels/stable/dartdoc-viewer/home => /stable
# /apidocs/channels/stable/dartdoc-viewer/dart:math => /stable/dart-math/dart-math-library.html
-# /apidocs/channels/stable/dartdoc-viewer/dart:async.Future => /stable/dart-async/Future.html
+# /apidocs/channels/stable/dartdoc-viewer/dart[:-]async.Future => /stable/dart-async/Future-class.html
def redir_name(handler, *args, **kwargs):
channel = kwargs['channel']
postfix = kwargs['path'][1:]
@@ -282,14 +282,14 @@ def redir_name(handler, *args, **kwargs):
name = postfix.replace(':', '-')
return '/%s/%s/%s-library.html' % (channel, name, name)
- # /apidocs/channels/stable/dartdoc-viewer/dart:async.Future => /stable/dart-async/Future-class.html
+ # /apidocs/channels/stable/dartdoc-viewer/dart[:-]async.Future => /stable/dart-async/Future-class.html
is_lib_and_class = LIB_NAME_AND_CLASS_NAME.match(postfix)
if is_lib_and_class:
lib_name = 'dart-' + is_lib_and_class.group(1)
class_name = is_lib_and_class.group(2)
return '/%s/%s/%s-class.html' % (channel, lib_name, class_name)
- self.error(404)
+ abort(404)
def redir_bare_lib_name(handler, *args, **kwargs):
version = kwargs['version']
« no previous file with comments | « server/app.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698