Fernando Rodríguez wrote:
> Hi,
> 
> I have the following regexes on my django app urls.py:
> 
> urlpatterns = patterns('',
>                        
>                        # List of all resumes for a given Career
>                        (r'(?P<career>[-\w]+)/$', career_list),
>                        
>                        # List of all resumes for a given jss
>                        (r'/jss/(?P<jss>[-\w]+)/$', jss_list),
>                        )
> 
> On my django project I have:
> 
> urlpatterns = patterns('',
>     # Access to the resume templates
>     (r'^resumes/', include('agbo.resume_templates.urls')),
> )
> 
> Whenever I try to call the second view (jss_list) with a url such as
> localhost:8000/resumes/jss/no-experience/ I get into trouble.
> 
> Instead of calling the second, django calls the first one and the group
> "career" contains "no-experience".  It looks like the "/jss/" is being
> ignored, but I don't know why. :-?
> 
> 
> If I try a url that doesn't exist, I get some interesting information:
> 
> ------ Page not Found error --------------------------------------------
> Using the URLconf defined in resume_templates_biz.urls, Django tried
> these URL patterns, in this order: 
> 
>      1. ^admin/doc/
>      2. ^admin/(.*)
>      3. ^resumes/ (?P<career>[-\w]+)/$
>      4. ^resumes/ /jss/(?P<jss>[-\w]+)/$
> 
> The current URL, resumes/, didn't match any of these.
> -----------------------------------------------------------------------
> 
> The url patterns 3 and 4 have a space  between "^resumes/" and the rest.
> I have no idead where that space is coming from or if it's the cause of
> the error mentioned above.

I'm fairly certain the space indicates an urls came from an "include". 
The spaces are not really part of regex.

One problem is the jss regex should not start with / since your resumes 
ends with one.

Another problem is your regex's don't include ^ match start of text. 
Without you t run into problems with regex doing partial match at end of 
string. Just like you are having your example.

Since you omit the match start your 1st urls matches:
   /resumes/jss/no-experience/
and
   /resumes/anything/at/all/ending_with_a_word_and_a_slash/word/

In latter case career would be word


Your urls should be like this:
   (r'^(?P<career>[-\w]+)/$', career_list),
   (r'^jss/(?P<jss>[-\w]+)/$', jss_list),


-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___________________________________________________________________________
It's August!  Keep your cool with the Statesman.  Check out our hot
deals in print and online for back-to-school savings and more!

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