On Jun 2, 2011, at 1:21 PM, pbreit wrote:
> So is this going away?
> from gluon.contrib.urlify import urlify
>
> Will I still be able to urlify without IS_SLUG()?
We could pull urlify out of IS_SLUG and make it available as validators.urlify.
It's already a static method, so it doesn't really care.
BTW (I'm writing a patch), the contrib version starts out like this:
s = s.lower()
# string normalization, eg è => e, ñ => n
s = unicodedata.normalize('NFKD', s.decode('utf-8')).encode('ASCII',
'ignore')
The IS_SLUG version does this:
s = value.decode('utf-8').lower() # to lowercase utf-8
s = unicodedata.normalize('NFKD', s) # normalize eg è => e, ñ => n
s = s.encode('ASCII', 'ignore') # encode as ASCII
Notice the difference in order:
lower decode encode normalize
vs
decode lower normalize encode
I think that normalize before encode makes sense. Does any of the rest matter?