On 5/9/07, gsmith <[EMAIL PROTECTED]> wrote:
>
> Is there any documentation of what these do? I'm assuming that this
> is a Python regular expression?
>
> The reason I ask is becuase I have a line in my urls.py file that
> looks like this
>
> (r'^csi/rso/(news|members)/(\w{1,100})/$',
> 'mysite.rso.views_rso.showtitlepage'), This works fine when the value
> of my url doesn't contain a "-". However, sometimes I have a url like
> below
>
> "csi/rso/members/the-test/"
>
> The above errors out becuase of the "-" in the url. Does anybody know
> what I need to use to accept the character "-" in the url?
>
> Also, on a side note...is it good to have \w{1,100}. This variable is
> going to be a name. I'll never know how long a name is and it's
> doubtful that a name would be 100 characters. Is there a better way
> of capturing this value.
>
> Thanks for any help
>
I suggest that you can test the length of the name in view method, and
don't limit the length of url pattern. The pattern could be:
[\w-]{1,100}
If you don't want {1,100}, you could [\w-]+
--
I like python!
UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---