﻿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
21899	Reverse does not work with function and namespace	Artem Skoretskiy	nobody	"'''django.core.urlresolvers.reverse''' does not work with function and namespace.

Example:

{{{
>>> from payment.views import *
>>> reverse('payment:payment.views.paypal_express_confirm') # resolve using namespace and view path
'/payment/paypal_express/confirm/'

>>> paypal_express_confirm # check function is there
<function paypal_express_confirm at 0x39f7668>

>>> reverse(paypal_express_confirm) # try direct resolve
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""django/core/urlresolvers.py"", line 476, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File ""django/core/urlresolvers.py"", line 396, in _reverse_with_prefix
    ""arguments '%s' not found."" % (lookup_view_s, args, kwargs))
NoReverseMatch: Reverse for 'payment.views.paypal_express_confirm' with arguments '()' and keyword arguments '{}' not found.

>>> reverse(paypal_express_confirm, current_app='payment') # try with current_app given
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""/home/tonnzor/projects/reelport-application/picturepipe/src/django/django/core/urlresolvers.py"", line 476, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File ""/home/tonnzor/projects/reelport-application/picturepipe/src/django/django/core/urlresolvers.py"", line 396, in _reverse_with_prefix
    ""arguments '%s' not found."" % (lookup_view_s, args, kwargs))
NoReverseMatch: Reverse for 'payment.views.paypal_express_confirm' with arguments '()' and keyword arguments '{}' not found.

>>> reverse(paypal_express_confirm, urlconf='payment.urls') # try app urls without namespaces or something
'/paypal_express/confirm/'
}}}

Sure it works when you open '''/payment/paypal_express/confirm/'''

My project:

'''/urls.py:'''

{{{
from django.conf.urls import *

urlpatterns = patterns('',
    url(r'^payment/', include('payment.urls', namespace='payment', app_name='payment')),
)
}}}

'''payment/urls.py:'''
{{{
from django.conf.urls.defaults import *

urlpatterns = patterns('payment.views',
    url(r'^paypal_express/confirm/$', 'paypal_express_confirm'),
)
}}}

'''payment/views.py:'''
{{{
from django.http import HttpResponse

def paypal_express_confirm(request):
    return HttpResponse('Confirm')

}}}

Sorry, I didn't get hands to test on master -- but I'm pretty sure it is still there."	Cleanup/optimization	closed	Documentation	1.4	Normal	duplicate		tonn81@…	Unreviewed	0	0	0	0	0	0
