+1 on this, been bitten repeatedly.

I assume the url parser already "knows" this so this is mostly a
matter of raising the appropriate exception.

Bien cordialement,
Philippe



On 12 October 2011 17:13, Wilfred Hughes <wilf...@potatolondon.com> wrote:
>> >    >>> reverse('i_dont_exist')
>> >    NoReverseMatch: Reverse for 'i_dont_exist' with arguments '()' and
>> > keyword arguments '{}' not found.
>>
>> > In this case, it would be nicer to have something like:
>>
>> >    NoURLPattern: No patterns specified for 'i_dont_exist'.
>>
>> Just on this point, I must disagree. For instance, consider if you
>> have a URL named 'i_dont_exist', and the URL pattern has two
>> positional arguments.
>
> Ah, sorry. I've been unclear. My point here is that when there /isn't/
> a URL with that name. It would be good to distinguish between having
> no regexes and not being able to reverse the regex.
>
> So, if I have an URL:
>
>    url(r'^fruit/(bananas|apples)$', some_view, name='fruit'),
>
> And I make a spelling mistake:
>
>    >>> reverse('rfuit', args=['bananas'])
>
> I would like some hint that the problem isn't in my regex. The two
> options I'm proposing are:
>
>    NoURLPattern: No patterns specified for 'rfuit'.
>
> Or:
>
>    NoReverseMatch: Reverse for 'rfuit' with arguments '()' and
> keyword arguments '{}' not found (patterns tried: []).
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-developers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to