I agree with pistacchio.

agree with you massimo on IS_SLUG for filtering only, if you want to
validate use IS_ALPHANUMERIC.

-Thadeus





On Sun, Jan 24, 2010 at 12:39 PM, Jonathan Lundell <[email protected]> wrote:
> On Jan 24, 2010, at 9:53 AM, mdipierro wrote:
>
>> I do not know about this. What do other people think?
>> I do not have a strong opinion either way.
>
> I think that slug is a fairly common term. WordPress uses it, for example.
>
> And if we make it a validator (I'm about to submit a patch), it definitely 
> can't be IS_URL().
>
>>
>> On Jan 24, 11:34 am, pistacchio <[email protected]> wrote:
>>> I'm ok with slugify, but the reason i chose "urlify" is that slug is
>>> not really a mvc term. It comes from the journalistic jargon and it's
>>> been adopted by the original Django developers that were working on a
>>> framework to build a newspaper site on.
>>>
>>> I don't think that "slug", outside the Django community, is a standard
>>> term to name such url-friendly strings. More often they're referred to
>>> as "pretty urls".
>>>
>>> On 24 Gen, 17:55, Jonathan Lundell <[email protected]> wrote:
>>>
>>>> On Jan 24, 2010, at 8:30 AM, mdipierro wrote:
>>>
>>>>> I will take a patch. ;-)
>>>
>>>> I'll contribute one. Any objection to changing the name to "slugify", 
>>>> since it's not really urlifying its input?
>>>
>>>>> On Jan 23, 7:03 pm, Jonathan Lundell <[email protected]> wrote:
>>>>>> urlify needs a comment to say explicitly what its intention is. That's 
>>>>>> partly because it suppresses quite a few characters that are normally 
>>>>>> legal in URLs, which is confusing.
>>>
>>>>>> Also,
>>>
>>>>>>> def urlify(s, max_length=80):
>>>>>>>     s = s.lower()
>>>>>>>     # string normalization, eg è => e, ñ => n
>>>>>>>     s = unicodedata.normalize('NFKD', 
>>>>>>> s.decode('utf-8')).encode('ASCII', 'ignore')
>>>>>>>     # strip entities
>>>>>>>     s = re.sub('&\w+;', '', s)
>>>
>>>>>> this should be '&\w+?;' (that is, non-greedy). Otherwise, a string like 
>>>>>> '&amp;whatever&amp;' will be completely eliminated.
>>>
>>>>>>>     # strip everything but letters, numbers, dashes and spaces
>>>>>>>     s = re.sub('[^a-z0-9\-\s]', '', s)
>>>>>>>     # replace spaces with dashes
>>>>>>>     s = s.replace(' ', '-')
>>>>>>>     # strip multiple contiguous dashes
>>>>>>>     s = re.sub('-{2,}', '-', s)
>>>>>>>     # strip dashes at the beginning and end of the string
>>>>>>>     s = s.strip('-')
>>>>>>>     # ensure the maximum length
>>>>>>>     s = s[:max_length-1]
>>>>>>>     return s
>>>
>>>>>> (Stylistically, I think it'd be more readable if the comments were 
>>>>>> appended to the relevant code lines.)
>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "web2py-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 
>>>>> athttp://groups.google.com/group/web2py?hl=en.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-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/web2py?hl=en.
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-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/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-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/web2py?hl=en.

Reply via email to