Brian Neal wrote:
>
> On Sep 16, 4:09 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
>   
>> Brian Neal wrote:
>>     
>>> I might have found my answer. I was looking at the list of
>>> incompatible changes and found this:
>>>       
>>> http://code.djangoproject.com/changeset/8760
>>>       
>>> Which led me to this:
>>>       
>>> http://docs.djangoproject.com/en/dev/topics/http/urls/#reverse
>>>       
>>> I quote from the docs:
>>>       
>>> "The reverse() function can reverse a large variety of regular
>>> expression patterns for URLs, but not every possible one. The main
>>> restriction at the moment is that the pattern cannot contain
>>> alternative choices using the vertical bar ("|") character. You can
>>> quite happily use such patterns for matching against incoming URLs and
>>> sending them off to views, but you cannot reverse such patterns."
>>>       
>>> This is exactly what I am trying to do. My pattern is using the |
>>> alternation. So apparently the url tag eventually calls reverse and it
>>> is failing to find my pattern.
>>>       
>> In which case a solution would appear to be to replace each alternate
>> with a separate pattern. It might seem distatsteful, but it should work ...
>>
>> regards
>>  Steve
>>     
>
> That was my fallback. In my case that would mean 8 URLs or so. Not too
> bad.
>
> However I just tried naming my pattern and referencing that from the
> template, and it worked!
>
>   
That's annoying: now *I* have a (named) pattern that won't reverse with
the URL tag: specifically, the edit profile URL from the Google code
profiles app:

                       url(r'^edit/$',
                           views.edit_profile,
                           name='profiles_edit_profile'),

When I use

 <a href="http://{{ host }}{% url profiles_edit_profile %}">

in my template Django tells me

  File "/home/sholden/Django-1.0/django/core/urlresolvers.py", line 252,
in reverse
    *args, **kwargs)))
  File "/home/sholden/Django-1.0/django/core/urlresolvers.py", line 241,
in reverse
    "arguments '%s' not found." % (lookup_view, args, kwargs))
NoReverseMatch: Reverse for 'PyTeach.'profiles_edit_profile'' with
arguments '()' and keyword arguments '{}' not found.

Aarrgghh!

regards
 Steve




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

Reply via email to