Projet

Général

Profil

« Précédent | Suivant » 

Révision 3677cd0c

Ajouté par Benjamin Dauvergne il y a environ 8 ans

flatten some config string to str (fixes #10416)

Voir les différences:

mandaye/server.py
73 73
    return response
74 74

  
75 75

  
76
def strize(v):
77
    '''Flatten unicode strings to str encoded as UTF-8'''
78
    if isinstance(v, unicode):
79
        return v.encode('utf-8')
80
    if isinstance(v, [list, tuple]):
81
        return type(v)([strize(e) for e in v])
82
    if isinstance(v, dict):
83
        return dict((strize(k), strize(e)) for k, e in v.iteritems())
84
    return v
85

  
86

  
76 87
class MandayeApp(object):
77 88

  
78 89
    def __init__(self):
......
115 126
                                    (param, conf_file)
116 127
                            logger.error(error)
117 128
                            raise ImproperlyConfigured, error
129
                    for param in ['location', 'target', 'server_name', 'mapper', 'auth_type']:
130
                        if param in conf:
131
                            conf[param] = strize(conf[param])
118 132
                    if not config.mappers.has_key(conf['mapper']):
119 133
                        err = '%s: mapper %s not found' % \
120 134
                                (conf_file, conf['mapper'])

Formats disponibles : Unified diff