Hi Karen, On Oct 10, 5:58 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Sat, Oct 10, 2009 at 6:34 PM, Scott SA <pydev...@gmail.com> wrote:
> > I am trying to use a series of generic views with custom filtering via > > callbacks as per: > I cannot figure out how this one differs from the next one, nor can I > recreate first two errors you are getting (I just get the no reverse match), > and in making further changes you seem to be moving further away from what > you want to achieve, so I'm just going to stop here and fix this one. Sweet, thank you. 8-) > First, the "P?<name>" should be "?P<name>". You've got the order of the ? > and the P reversed. Finger dyslexia, happens all teh time! Was, and remains, correct in the urls file. I fabricated the stripped- down example to try to get to the heart of the matter without excessive detail. > Second, since you are specifying this as a bare tuple and not using url(), I tried using url() and others after reading the 'url' and 'patterns' source. > and you want to specify the optional name as 'url-pattern-name', you must > also include the optional dictionary which comes before the optional name as > defined here: > > http://docs.djangoproject.com/en/dev/topics/http/urls/#patterns > Given what you have 'url-pattern-name' is being taken to be the optional > dictionary, not the optional name. So change it to: > > (r'path/(?P<name>[\w\d-]+)/?$', my_filter_callback, {}, > 'url-pattern-name'), Hmm, I thought I had done that but maybe something else was also wrong causing me to follow the wrong path for troubleshooting. > or use url() (read down further in the doc pointed to), omit the dictionary, > and specify the name via keyword: > > url(r'path/(?P<name>[\w\d-]+)/?$', my_filter_callback, > name='url-pattern-name'), Okay, I know for sure that I tried this, may still have that code commented out. This is where I received the error that the 'name' attribute was being passed to 'my_filter_callback', as I recall. I'll give this another try just to be sure it wasn't a "red herring" that sucked a few hours out of my day. After having gone back and adding the empty dictionary in the patterns (prefix, tuple...) call, I now get resolution and reverse for that URL. The second part of my prev. statement re. the url call seems the likely culprit, and a quick double-check on the url() call just proved it. The problem is another reverse url call later in the page template, similar name, different regex, etc. 8-( Thanks for the quick and very informative reply, greatly appreciated. Sorry for the 'red herring' issue! Scott --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---