This is kind of an extension of an earlier (mostly unresolved) issue I
had brought up here:
http://groups.google.com/group/django-users/browse_thread/thread/63beb7566dc352a8/1e6e137f5b5a434a

Here's my current url conf (I've commented out everything else):

url(r'^(johndoe|janedoe)/$', 'translator', name="translator"),
url(r'^(johndoe|janedoe)/(?P<entryName>[\w\d-]+)/$', 'entry',
name="entry"),

I would be using named groups on the first segment match, but named
groups and the | still don't seem to be working.

These two views accept their arguments like so:

def translator(request, translatorName):
    ...

def entry(request, translatorName, entryName=None):
   ....

I can't get {% url %} tags based on these views to work -- they fail
silently on most everything. Using reverse() to see what's going on, I
find that:

reverse('translator', args=['johndoe'])

Gets me the correct url, while this fails:

{% url translator johndoe %}

Looking into the url tag code, I don't see why that would happen. When
I try reverse() on the 'entry' view, like this:

reverse('entry', args=['johndoe'], kwargs={'entryName':'blogentry'})

I get this traceback:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 297, in reverse
    return iri_to_uri(u'/' + get_resolver(urlconf).reverse(viewname,
*args, **kwargs))
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 283, in reverse
    return u''.join([reverse_helper(part.regex, *args, **kwargs) for
part in self.reverse_dict[lookup_view]])
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 88, in reverse_helper
    result = re.sub(r'\(([^)]+)\)', MatchChecker(args, kwargs),
regex.pattern)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/re.py", line 142, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "/Library/Python/2.5/site-packages/django/core/
urlresolvers.py", line 128, in __call__
    if not re.match(test_regex + '$', force_unicode(value),
re.UNICODE):
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/re.py", line 129, in match
    return _compile(pattern, flags).match(string)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/re.py", line 233, in _compile
    raise error, v # invalid expression
error: nothing to repeat

*******
Changing the url conf so that both of the arguments are positional,
rather than one positional and one named, and then calling
reverse('entry', args=['johndoe','blogentry']), gets me the same
error.

What am I not understanding about url configuration and reverse()!!??

Thanks in advance,
Eric
--~--~---------~--~----~------------~-------~--~----~
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