#8391: Admin slugify function's results differ from those of slugify template
filter
------------------------------------+---------------------------------------
          Reporter:  bjornkri       |         Owner:  nobody   
            Status:  new            |     Milestone:  1.0 maybe
         Component:  Uncategorized  |       Version:  SVN      
        Resolution:                 |      Keywords:           
             Stage:  Unreviewed     |     Has_patch:  0        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by bjornkri):

 My efforts at translating the javascript so far fall flat at the way
 python matches things:

 {{{
 import re

 LATIN_MAP = {
 'ö': 'o'
 }

 regex = re.compile('[ö]|[^ö]+')

 pieces = regex.findall('björn')

 downcoded = ""
 for piece in pieces:
     mapped = ""
     try:
         mapped = LATIN_MAP[piece]
     except:
         mapped = piece
     downcoded += mapped

 print pieces, downcoded

 # Expected: ['bj', 'ö', 'rn'] bjorn
 # Result: ['bj', '\xc3', '\xb6' 'rn'] björn
 }}}

 I.e. {{{ LATIN_MAP['ö'] }}} isn't looked up, but {{{ LATIN_MAP['\xc3'] }}}
 and {{{ LATIN_MAP['\xb6'] }}} are, separately. {{{ LATIN_MAP['\xc3\xb6']
 }}} would work, but how to make sure these 'stay together' is something
 that leaves me stumped.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8391#comment:11>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to