On Sat, 2006-06-24 at 13:59 +0100, Frankie Robertson wrote:
[...]
> 
> I have another, smaller related problem with urls.
> I can't do this
> (r'^blogs/([_A-Za-z0-9-]+)/', include('bloghost.blog.urls')),
> because then the captured bit after blogs doesn't go anywhere.
> I have to do this:
> ..
> (r'^blogs/([_A-Za-z0-9-]+)/', 'frontpage')),
> (r'^blogs/([_A-Za-z0-9-]+)/feed/', 'rss')),
> ...
> 
> Which is fine really, more of an itch than anything else, but it'd be
> nice to do it the Right Way(TM).

The way to do this is to capture into a named group in the reg-exp,
rather than just an anonymous, positional group. This will then be
passed through to your subsequent URL resolvers, as described in [1].

In your case, make your reg-exp something like

        r'^blogs/(?P<xyzzy>[_A-Za-z0-9-]+)/'
        
and your views will be passed a "xyzzy" keyword argument, not matter how
many other URLConfs are included in the pipeline.

[1]
http://www.djangoproject.com/documentation/url_dispatch/#captured-parameters

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to