ATM there are no dict mappings available for the function included in 
web2py. 
You can use the function directly with IS_SLUG()('whatever_string') in 
which case you have a tuple returned with (result, error) or directly with 
IS_SLUG().urlify('whatever_string') which returns only the result as a 
string. There are only two parameters, maxlen (it truncates the string to n 
chars) and keep_underscores (by default is false, so every _ gets 
translated to a - (hypen))



On Sunday, August 18, 2013 12:17:20 PM UTC+2, lesssugar wrote:
>
> Docs site specifies *IS_SLUG.urlify.__dict__ *and *IS_SLUG.urlify.func_dict. 
> *However, I'm not sure how to work with dictionary here.
>
> Can I e.g. do something like this:
>
> IS_SLUG.urlify(string_to_convert, mapping_dictionary)
>
> and simply tell the function which set of key-value pairs it should use?
>
> On Sunday, August 18, 2013 11:23:35 AM UTC+2, Niphlod wrote:
>>
>> indeed, "our" urlify doesn't work with "ideograms" (sorry, I'm totally no 
>> expert in oriental languages).
>> The original posted solution takes care of "translating" 
>>
>> 派森是好物
>> to
>> pai-sen-shi-hao-wu
>>
>>
>> we can add the feature looking at other similar projects, but we need 
>> someone that has a solid knowledge of oriental (and turkish, polish, 
>> latvian, polish, czech) to write tests.
>>
>> On Sunday, August 18, 2013 10:00:32 AM UTC+2, Massimo Di Pierro wrote:
>>>
>>> Look ate the source code of urlify:
>>> https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2525
>>>
>>> If you can suggest improvements I will happy to include them. I guess 
>>> the problem is here:
>>>
>>> https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2534
>>>
>>> Massimo
>>>
>>> On Friday, 16 August 2013 07:39:50 UTC-5, lesssugar wrote:
>>>>
>>>> I'm using the following module to convert my urls:
>>>>
>>>>
>>>> http://pydoc.net/Python/redsolutioncms.django-hex-storage/0.1.1/pinyin.urlify/
>>>>
>>>> I have urlify.py (main function) and maps.py (chars mapping) in my 
>>>> /modules. I test it in one of my views, simply trying to print the 
>>>> urlify-ed value in the console:
>>>>
>>>> {{from urlify import urlify}}
>>>> {{print urlify(u"łźć ęćm")}}
>>>>
>>>> I get "aaa-aaa", so basically there's no mapping done and I have no 
>>>> idea why.
>>>>
>>>>
>>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to