Changeset 3974

Show
Ignore:
Timestamp:
01/18/08 17:26:24 (7 months ago)
Author:
faide
Message:

remove the re-encoding from the VisitFilter?. A test still fails but when I test it manually in a project I confirm I have unicode objects from the params.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/turbogears/identity/tests/test_identity.py

    r3831 r3974  
    124124        decode = formencode.variabledecode.variable_decode 
    125125        params = decode(dict([p.split('=') for p in params.split('&')])) 
     126 
    126127        if params == cherrypy.request.params: 
    127128            return 'params ok' 
     
    129130            return 'wrong params: %s\nexpected: %s' % ( 
    130131                params, cherrypy.request.params) 
     132 
    131133    test_params = turbogears.expose()(test_params) 
    132134    test_params = identity.require(identity.not_anonymous())(test_params) 
     
    459461        assert 'identity_failed' in firstline, firstline 
    460462 
    461     def test_decode_filter(self): 
    462         """Test that the decode filter doesn't break with nested 
     463    def test_decode_filter_whenidfails(self): 
     464        """Test that the decode filter doesn't break with nested\ 
    463465        variables and Identity""" 
    464466        params = urllib.quote(IdentityRoot._test_params.decode('utf-8').encode('latin-1'), '=&') 
     
    466468        firstline = cherrypy.response.body[0] 
    467469        assert 'identity_failed_answer' in firstline, firstline 
     470 
     471    def test_decode_filter_whenidworks(self): 
     472        """Test that the decode filter doesn't break with nested\ 
     473        variables and Identity""" 
     474        params = urllib.quote(IdentityRoot._test_params.decode('utf-8').encode('latin-1'), '=&') 
    468475        params += '&user_name=samIam&password=secret&login=Login' 
    469476        testutil.create_request('/test_params?' + params) 
  • branches/1.0/turbogears/visit/api.py

    r3900 r3974  
    247247            cherrypy.request.object_path = e.path 
    248248 
    249         def encode_utf8(value): 
    250             ''' 
    251             recursively encode all values in a dictionary to utf-8 
    252             ''' 
    253             if isinstance(value, dict): 
    254                 for k, v in value.items(): 
    255                     value[k] = encode_utf8(v) 
    256             elif isinstance(value, list): 
    257                 return map(encode_utf8, value) 
    258             elif isinstance(value, unicode): 
    259                 return value.encode('utf-8') 
    260             return value 
    261  
    262         encode_utf8(cherrypy.request.params) 
    263  
    264249    def _generate_key(self): 
    265250        '''