Revision c2122f56
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
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