Project

General

Profile

Revision c2122f56

IDc2122f56e6049243cbb1bbb8a22ab81cebf224e6
Parent 6a7fa300
Child 6a0204a8

Added by Francois POIROTTE over 13 years ago

L'hôte doit être de type str et non unicode.

La fonction urllib2.quote() n'accepte que des arguments de type str.
Il faut d'abord encoder nos types unicode en str (UTF-8) avant de
l'appeler.

git-svn-id: https://vigilo-dev.si.c-s.fr/svn@6552 b22e2e97-25c9-44ff-b637-2e5ceca36478

View differences:

vigigraph/controllers/rpc.py
287 287
        error_handler = process_form_errors)
288 288
    @expose('json')
289 289
    def startTime(self, host, nocache):
290
        # urllib2.quote() ne fonctionne pas sur le type unicode.
291
        # On transcode d'abord le nom d'hôte en UTF-8.
292
        quote_host = isinstance(host, unicode) and \
293
                        host.encode('utf-8') or host
290 294
        return get_through_proxy(
291 295
            'vigirrd', host,
292
            '/starttime?host=%s' % urllib2.quote(host, '')
296
            '/starttime?host=%s' % urllib2.quote(quote_host, '')
293 297
        )
294 298

  
295 299
    class FullHostPageSchema(schema.Schema):

Also available in: Unified diff