From 972ab07c35b8b871716a22b5ea84671eb3516636 Mon Sep 17 00:00:00 2001 From: KeyserSosa Date: Fri, 25 Jul 2008 16:00:20 -0700 Subject: [PATCH] added handling of unicode destinations on redirects. Also fixed a 500 when submit tries to redirect to a /comments apge --- r2/r2/controllers/api.py | 2 +- r2/r2/lib/base.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 51c53ac1b..e588eac73 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -52,7 +52,7 @@ from r2.lib.organic import update_pos def link_listing_by_url(url, count = None): try: - links = tup(Link._by_url(url, sr = c.site)) + links = list(tup(Link._by_url(url, sr = c.site))) links.sort(key = lambda x: -x._score) if count is not None: links = links[:count] diff --git a/r2/r2/lib/base.py b/r2/r2/lib/base.py index a243bdd70..f4fd44eb5 100644 --- a/r2/r2/lib/base.py +++ b/r2/r2/lib/base.py @@ -25,7 +25,7 @@ from pylons.controllers import WSGIController, Controller from pylons.i18n import N_, _, ungettext, get_lang import r2.lib.helpers as h from r2.lib.utils import to_js -from r2.lib.filters import spaceCompress +from r2.lib.filters import spaceCompress, _force_unicode from utils import storify, string2js, read_http_date import re, md5 @@ -90,7 +90,7 @@ class BaseController(WSGIController): @staticmethod def redirect(dest, code = 302): - c.response.headers['Location'] = dest + c.response.headers['Location'] = _force_unicode(dest).encode('utf8') c.response.status_code = code return c.response