Revision 112a752a
Contournement bug de Routes (#1149).
Contourne un bug de Routes (https://github.com/bbangert/routes/issues/7)
empêchant l'utilisation de "host" comme nom de paramètre (ce dont nous
avons besoin pour les pages de Nagios).
Le contournement consiste à :
- Reprendre le code de url() issu de TG 2.2.2 (licence MIT).
- Adapter les appels à url()/redirect() pour prendre en compte le
changement d'API induit.
Change-Id: Ifba5073f6ccc7303bb8e22419699b7b1ad98ac53
Refs: #1149.
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/1125
Tested-by: Build system <qa@vigilo-dev.si.c-s.fr>
Reviewed-by: Thomas BURGUIERE <thomas.burguiere@c-s.fr>
vigigraph/tests/functional/test_fullhostpage.py | ||
---|---|---|
7 | 7 |
permettant d'afficher tous les graphes |
8 | 8 |
associés à un hôte. |
9 | 9 |
""" |
10 |
import transaction, urllib2
|
|
10 |
import transaction, urllib |
|
11 | 11 |
|
12 | 12 |
from vigigraph.tests import TestController |
13 | 13 |
from vigilo.models.session import DBSession |
... | ... | |
40 | 40 |
if hosts[host]: |
41 | 41 |
response = self.app.get( |
42 | 42 |
'/rpc/fullHostPage?host=%s' % |
43 |
urllib2.quote(host.encode('utf-8')),
|
|
43 |
urllib.quote_plus(host.encode('utf-8')),
|
|
44 | 44 |
extra_environ={"REMOTE_USER": user} |
45 | 45 |
) |
46 | 46 |
index = int(host[4]) |
47 | 47 |
self.assertTrue( |
48 | 48 |
'/vigirrd/%s/index?graphtemplate=%s' % ( |
49 |
urllib2.quote((u'host%d éà' % index).encode('utf-8')),
|
|
50 |
urllib2.quote((u'graph%d éà' % index).encode('utf-8')),
|
|
49 |
urllib.quote((u'host%d éà' % index).encode('utf-8'), ''),
|
|
50 |
urllib.quote_plus((u'graph%d éà' % index).encode('utf-8')),
|
|
51 | 51 |
) in response.unicode_body |
52 | 52 |
) |
53 | 53 |
else: |
54 | 54 |
response = self.app.get( |
55 | 55 |
'/rpc/fullHostPage?host=%s' % |
56 |
urllib2.quote(host.encode('utf-8')),
|
|
56 |
urllib.quote_plus(host.encode('utf-8')),
|
|
57 | 57 |
extra_environ={"REMOTE_USER": user}, |
58 | 58 |
status = 403 |
59 | 59 |
) |
... | ... | |
90 | 90 |
for host in (u'host1 éà', u'host2 éà', u'host3 éà'): |
91 | 91 |
self.app.get( |
92 | 92 |
'/rpc/fullHostPage?host=%s' % |
93 |
urllib2.quote(host.encode('utf-8'), ''),
|
|
93 |
urllib.quote_plus(host.encode('utf-8')),
|
|
94 | 94 |
status=401 |
95 | 95 |
) |
96 | 96 |
|
vigigraph/tests/functional/test_opensearch.py | ||
---|---|---|
6 | 6 |
Teste l'utilisation du module de recherche |
7 | 7 |
OpenSearch intégré au navigateur. |
8 | 8 |
""" |
9 |
import transaction, urllib2
|
|
9 |
import transaction, urllib |
|
10 | 10 |
|
11 | 11 |
from vigigraph.tests import TestController |
12 | 12 |
from vigilo.models.session import DBSession |
... | ... | |
44 | 44 |
if hosts[host]: |
45 | 45 |
self.assertTrue( |
46 | 46 |
u'/rpc/fullHostPage?host=%s' % |
47 |
urllib2.quote(host.encode('utf-8'))
|
|
47 |
urllib.quote_plus(host.encode('utf-8'))
|
|
48 | 48 |
in response.unicode_body |
49 | 49 |
) |
50 | 50 |
else: |
51 | 51 |
self.assertTrue( |
52 | 52 |
u'/rpc/fullHostPage?host=%s' % |
53 |
urllib2.quote(host.encode('utf-8'))
|
|
53 |
urllib.quote_plus(host.encode('utf-8'))
|
|
54 | 54 |
not in response.unicode_body |
55 | 55 |
) |
56 | 56 |
|
... | ... | |
86 | 86 |
for host in (u'host1 éà', u'host2 éà', u'host3 éà'): |
87 | 87 |
self.app.get( |
88 | 88 |
'/rpc/fullHostPage?host=%s' % |
89 |
urllib2.quote(host.encode('utf-8'), ''),
|
|
89 |
urllib.quote_plus(host.encode('utf-8')),
|
|
90 | 90 |
status=401 |
91 | 91 |
) |
92 | 92 |
|
Also available in: Unified diff