Projet

Général

Profil

0001-python3-convert-.values-to-list-before-accessing-408.patch

Nicolas Roche, 19 mars 2020 13:34

Télécharger (2,11 ko)

Voir les différences:

Subject: [PATCH] python3: convert .values to list before accessing (#40830)

 welco/contacts/views.py | 2 +-
 welco/utils.py          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
welco/contacts/views.py
128 128
        msg = {}
129 129
        for field_key in form.fields:
130 130
            if form[field_key].value():
131 131
                msg[field_key] = form[field_key].value()
132 132

  
133 133
        msg['password'] = str(random.SystemRandom().random())
134 134
        msg['send_registration_email'] = getattr(settings, 'CONTACT_SEND_REGISTRATION_EMAIL', True)
135 135

  
136
        authentic_site = settings.KNOWN_SERVICES.get('authentic').values()[0]
136
        authentic_site = list(settings.KNOWN_SERVICES.get('authentic').values())[0]
137 137
        authentic_url = authentic_site.get('url')
138 138
        authentic_orig = authentic_site.get('orig')
139 139
        authentic_secret = authentic_site.get('secret')
140 140

  
141 141
        url = authentic_url + 'api/users/?orig=%s' % authentic_orig
142 142
        signed_url = sign_url(url, authentic_secret)
143 143

  
144 144
        logger = logging.getLogger(__name__)
welco/utils.py
143 143
            headers={'Content-type': 'application/json'})
144 144
    if response.json().get('err') != 0:
145 145
        raise Exception('error %r' % response.content)
146 146
    data = response.json()['data']
147 147
    return data['id'], data.get('backoffice_url')
148 148

  
149 149

  
150 150
def get_wcs_data(endpoint, params=None):
151
    wcs_site = get_wcs_services().values()[0]
151
    wcs_site = list(get_wcs_services().values())[0]
152 152
    wcs_site_url = wcs_site['url']
153 153
    if not wcs_site_url.endswith('/'):
154 154
        wcs_site_url += '/'
155 155
    url = wcs_site_url + endpoint
156 156

  
157 157
    if not params:
158 158
        params = {}
159 159

  
160
-