0001-base_adresse-prefer-urljoin-to-os.path.join-11497.patch
passerelle/apps/base_adresse/models.py | ||
---|---|---|
4 | 4 |
import urlparse |
5 | 5 |
import unicodedata |
6 | 6 | |
7 |
import six |
|
8 | 7 | |
9 | 8 |
from django.db import connection, models |
10 | 9 |
from django.db.models import Q |
11 | 10 |
from django.utils.http import urlencode |
12 | 11 |
from django.utils.translation import ugettext_lazy as _ |
13 | 12 |
from django.utils import timezone |
13 |
from django.utils import six |
|
14 |
from django.utils.six.moves.urllib.parse import urljoin |
|
14 | 15 | |
15 | 16 |
from passerelle.base.models import BaseResource |
16 | 17 |
from passerelle.utils.api import endpoint |
... | ... | |
42 | 43 |
return [] |
43 | 44 | |
44 | 45 |
scheme, netloc, path, params, query, fragment = urlparse.urlparse(self.service_url) |
45 |
path = os.path.join(path, 'search/')
|
|
46 |
path = urljoin(path, 'search/')
|
|
46 | 47 |
query_args = {'q': q, 'limit': 1} |
47 | 48 |
if zipcode: |
48 | 49 |
query_args['postcode'] = zipcode |
... | ... | |
73 | 74 |
raise NotImplementedError() |
74 | 75 | |
75 | 76 |
scheme, netloc, path, params, query, fragment = urlparse.urlparse(self.service_url) |
76 |
path = os.path.join(path, 'reverse/')
|
|
77 |
path = urljoin(path, 'reverse/')
|
|
77 | 78 |
query = urlencode({'lat': lat, 'lon': lon}) |
78 | 79 |
url = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) |
79 | 80 | |
80 |
- |