added handling of unicode destinations on redirects. Also fixed a 500 when submit tries to redirect to a /comments apge

This commit is contained in:
KeyserSosa
2008-07-25 16:00:20 -07:00
parent 557a248f2a
commit 972ab07c35
2 changed files with 3 additions and 3 deletions

View File

@@ -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]

View File

@@ -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