Re: Can I use a underscore in my url to separate variables?

2008-01-02 Thread Peter Rowell
(This is hedronist in his disguise as himself, whatever that means.) > www.mysite.com/sprint_cellular_M1000/ Ah, something specific. Of course, it doesn't look like what you first posted, but I kind of suspected that. I'll say it one more time, if you have a specific problem, then you need to

Re: Can I use a underscore in my url to separate variables?

2008-01-02 Thread Greg
Hedronist, Thanks for the reply. I tried your suggestion but it still doesn't work. Thanks for the link. I'll look it over and hopefully be able to solve the problem. In regards to having all of my pages as close to the root as possible. I was reading that search engines put more importance

Re: Can I use a underscore in my url to separate variables?

2008-01-02 Thread hedronist
> Tried it...still no good When in doubt, supply specifics, as in 'exactly what is the specific URL you are trying to match?' The given pattern matches an appropriate URL correctly. E.g. >>> import re >>> x = 'foobar_abcde/' >>> m = re.match(r'^(?P[a-zA-Z]+)_(?P[a-zA-Z]+)/$', x) >>> print

Re: Can I use a underscore in my url to separate variables?

2008-01-02 Thread Todd O'Bryan
Try downloading Kodos and sticking in your regex and the string you want to match it and see what it says. Todd On Jan 2, 2008 12:59 AM, Greg <[EMAIL PROTECTED]> wrote: > > ocgstyles, > Tried it...still no good > > (r'^(?P[a-zA-Z]+)_(?P[a-zA-Z]+)/$', 'showline'), > > > On Jan 1, 11:23 pm,

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread Greg
ocgstyles, Tried it...still no good (r'^(?P[a-zA-Z]+)_(?P[a-zA-Z]+)/$', 'showline'), On Jan 1, 11:23 pm, ocgstyles <[EMAIL PROTECTED]> wrote: > I'm confused now too... :-/ > > Try taking out the hyphen and see what happens... > > On Jan 1, 11:45 pm, Greg <[EMAIL PROTECTED]> wrote: > > > Todd,

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread ocgstyles
I'm confused now too... :-/ Try taking out the hyphen and see what happens... On Jan 1, 11:45 pm, Greg <[EMAIL PROTECTED]> wrote: > Todd, > My app works fine. When I have the following line in my url file then > everything works fine > > (r'^(?P[\w-]+)/(?P[\w-]+)/$', 'showline'), > >

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread Greg
Todd, My app works fine. When I have the following line in my url file then everything works fine (r'^(?P[\w-]+)/(?P[\w-]+)/$', 'showline'), / It just doesn't work with I take out the '/' and replace it with the '_' On Jan 1, 10:25 pm, "Todd O'Bryan" <[EMAIL PROTECTED]> wrote: >

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread Todd O'Bryan
Have you added the app to your INSTALLED_APPS ? Maybe you should paste in your site's urls.py as well as the app's. On Jan 1, 2008 11:09 PM, Greg <[EMAIL PROTECTED]> wrote: > > ocgstyles, > I've tried the following combinations however I still get the Page Not > Found error: > >

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread Greg
ocgstyles, I've tried the following combinations however I still get the Page Not Found error: (r'^(?P[a-zA-Z-]+)_(?P[a-zA-Z-]+)/$', 'showline'), (r'^(?P[-a-zA-Z]+)_(?P[-a-zA-Z]+)/$', 'showline'), (r'^(?P[a-zA-Z\-]+)_(?P[a-zA-Z\-]+)/$', 'showline'), (r'^(?P[a-zA-Z_]+)_(?P[a-zA-Z_]+)/$',

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread ocgstyles
I thought you wanted to capture either words or hyphens, so I just replaced \w, which also consumes underscores, with [a-zA-Z], which doesn't consume the underscores. So the new regex [a-zA-Z-]+ will consume one or more letters or hyphens. The one I replaced it with should work for

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread Todd O'Bryan
No, because he doesn't want it to match the underscore. I think this works: [-a-zA-Z] because a hyphen in the first position matches a literal hyphen. However, to be sure, you can use a backslash [a-zA-Z\-] For all regex questions, I highly recommend the Kodos app. It lets you enter Python

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread owen
I think that should be an underscore: [a-zA-Z_] Owen -Original Message- From: Greg <[EMAIL PROTECTED]> Sent: Tuesday, January 1, 2008 10:36pm To: Django users Subject: Re: Can I use a underscore in my url to separate variables? ocgstyles, I'm not sure

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread Greg
ocgstyles, I'm not sure what's going on. What does the last '-' mean in the following code [a-zA-Z-]? Occasionally I'm going to have the a url that is going to have a '-' in the variable. For example http://mysite.com/sprint-phone_cellphone. So I'm not sure if [a-zA- Z-] is going to work. On

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread ocgstyles
worked for me using the following: [urls.py] (i removed the single quotes around the view) from myapp.views import showline (r'^(?P[a-zA-Z-]+)_(?P[\w-]+)/$', showline), [views.py] def showline(request, manufacturer, line): return HttpResponse('manu = ' + manufacturer + 'line = ' + line)

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread Greg
ocgstyles, I tried the following however I'm still getting a page not found error: (r'^(?P[a-zA-Z-]+)_(?P[\w-]+)/$', 'showline'), On Jan 1, 8:23 pm, ocgstyles <[EMAIL PROTECTED]> wrote: > Hi Greg, > > The problem is that "\w" is consuming the underscore. Instead of > using [\w-], use

Re: Can I use a underscore in my url to separate variables?

2008-01-01 Thread ocgstyles
Hi Greg, The problem is that "\w" is consuming the underscore. Instead of using [\w-], use [a-zA-Z-]. The pattern would then look like: (r'^(?P[a-zA-Z-]+)_(?P[\w-]+)/$', 'showline') Hope that helps. Keith On Jan 1, 9:05 pm, Greg <[EMAIL PROTECTED]> wrote: > Hello, > I orginially had my url

Can I use a underscore in my url to separate variables?

2008-01-01 Thread Greg
Hello, I orginially had my url like this: (r'^(?P[\w-]+)/(?P[\w-]+)/$', 'showline') Which would work fine when going to the url 'www.mysite.com/sprint/ cellphone/' // However, I want to change my url structure so that all of my pages are as close to the root as possible. So I