﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20022	reverse() breaks on URLs which include a ~ character	mxheyeck@…	Baptiste Mispelon	"Testing on my local machine through Apache, so the root URL is at:

  http://localhost/~mxheyeck/sicariid/

Calling reverse on one of my views inside views.py, e.g.:

  s = reverse(locate_task_enter, args=(task_id,))

Breaks with the cryptic message:

  ""a float is required""

A little examination reveals what's going on.  Break is at line 391 of urlresolvers.py.

  candidate = (prefix_norm + result) % dict(zip(prefix_args + params, unicode_args))

prefix_norm is:

  u'/%7Emxheyeck/sicariid/'

So line 391 is equivalent to:

  u'/%7Emxheyeck/sicariid/locate_task_enter/%(task_id)s/' % {u'task_id': u'419'}

Where '%7E' is both a urlencoded tilde and, unfortunately, an upper-case floating-point exponential.  So, boom.

I attach the local vars from the break at 391.


{{{
val		419L
pattern		'locate_task_enter/(?P<task_id>\\d+)/$'
self		<RegexURLResolver 'sitespecific.urls' (None:None) ^/>
args		(419L,)
_prefix		u'/~mxheyeck/sicariid/'
possibility	[(u'locate_task_enter/%(task_id)s/', [u'task_id'])]
unicode_args	[u'419']
possibilities	[([(u'locate_task_enter/%(task_id)s/', [u'task_id'])],  'locate_task_enter/(?P<task_id>\\d+)/$',  {})]
lookup_view	<function locate_task_enter at 0x1065f8668>
prefix_norm	u'/%7Emxheyeck/sicariid/'
prefix_args	[]
params		[u'task_id']
result		u'locate_task_enter/%(task_id)s/'
defaults	{}
kwargs		{}
}}}
"	Bug	closed	Core (URLs)	1.5	Normal	fixed		bmispelon@…	Accepted	0	0	0	0	0	0
