umap-project 1.11.0__py3-none-any.whl → 1.11.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/admin.py +7 -3
- umap/autocomplete.py +3 -5
- umap/bin/__init__.py +2 -5
- umap/decorators.py +4 -5
- umap/forms.py +5 -5
- umap/locale/en/LC_MESSAGES/django.po +14 -14
- umap/management/commands/generate_js_locale.py +9 -11
- umap/management/commands/import_pictograms.py +1 -1
- umap/managers.py +5 -3
- umap/middleware.py +2 -3
- umap/migrations/0001_initial.py +204 -56
- umap/migrations/0002_tilelayer_tms.py +3 -4
- umap/migrations/0003_add_tilelayer.py +13 -9
- umap/migrations/0004_add_licence.py +3 -6
- umap/migrations/0005_remove_map_tilelayer.py +3 -4
- umap/migrations/0006_auto_20190407_0719.py +6 -5
- umap/migrations/0007_auto_20190416_1757.py +13 -5
- umap/migrations/0008_alter_map_settings.py +0 -1
- umap/migrations/0009_star.py +27 -8
- umap/migrations/0010_alter_map_edit_status_alter_map_share_status.py +20 -8
- umap/migrations/0011_alter_map_edit_status_alter_map_share_status.py +21 -8
- umap/migrations/0014_map_created_at.py +1 -1
- umap/models.py +6 -6
- umap/settings/base.py +1 -4
- umap/static/umap/base.css +2 -0
- umap/static/umap/js/umap.core.js +2 -0
- umap/static/umap/js/umap.features.js +2 -2
- umap/static/umap/js/umap.js +9 -5
- umap/static/umap/js/umap.layer.js +3 -2
- umap/static/umap/map.css +21 -12
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +13 -1
- umap/templates/auth/user_form.html +2 -2
- umap/templates/base.html +9 -3
- umap/templates/umap/map_table.html +3 -3
- umap/templatetags/umap_tags.py +32 -34
- umap/tests/base.py +2 -1
- umap/tests/conftest.py +0 -1
- umap/tests/integration/test_picto.py +1 -1
- umap/tests/integration/test_slideshow.py +70 -0
- umap/tests/settings.py +7 -5
- umap/tests/test_datalayer.py +7 -6
- umap/tests/test_map.py +6 -5
- umap/tests/test_map_views.py +4 -10
- umap/tests/test_tilelayer.py +17 -11
- umap/tests/test_views.py +7 -6
- umap/urls.py +3 -3
- umap/utils.py +1 -2
- umap/views.py +11 -23
- umap/wsgi.py +2 -2
- {umap_project-1.11.0.dist-info → umap_project-1.11.1.dist-info}/METADATA +11 -9
- {umap_project-1.11.0.dist-info → umap_project-1.11.1.dist-info}/RECORD +55 -54
- {umap_project-1.11.0.dist-info → umap_project-1.11.1.dist-info}/WHEEL +0 -0
- {umap_project-1.11.0.dist-info → umap_project-1.11.1.dist-info}/entry_points.txt +0 -0
- {umap_project-1.11.0.dist-info → umap_project-1.11.1.dist-info}/licenses/LICENSE +0 -0
umap/templatetags/umap_tags.py
CHANGED
|
@@ -10,53 +10,50 @@ from ..views import _urls_for_js
|
|
|
10
10
|
register = template.Library()
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@register.inclusion_tag(
|
|
13
|
+
@register.inclusion_tag("umap/css.html")
|
|
14
14
|
def umap_css():
|
|
15
|
-
return {
|
|
16
|
-
"STATIC_URL": settings.STATIC_URL
|
|
17
|
-
}
|
|
15
|
+
return {"STATIC_URL": settings.STATIC_URL}
|
|
18
16
|
|
|
19
17
|
|
|
20
|
-
@register.inclusion_tag(
|
|
18
|
+
@register.inclusion_tag("umap/js.html")
|
|
21
19
|
def umap_js(locale=None):
|
|
22
|
-
return {
|
|
23
|
-
"STATIC_URL": settings.STATIC_URL,
|
|
24
|
-
"locale": locale
|
|
25
|
-
}
|
|
20
|
+
return {"STATIC_URL": settings.STATIC_URL, "locale": locale}
|
|
26
21
|
|
|
27
22
|
|
|
28
|
-
@register.inclusion_tag(
|
|
23
|
+
@register.inclusion_tag("umap/map_fragment.html")
|
|
29
24
|
def map_fragment(map_instance, **kwargs):
|
|
30
25
|
layers = DataLayer.objects.filter(map=map_instance)
|
|
31
26
|
datalayer_data = [c.metadata() for c in layers]
|
|
32
27
|
map_settings = map_instance.settings
|
|
33
28
|
if "properties" not in map_settings:
|
|
34
|
-
map_settings[
|
|
35
|
-
map_settings[
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
29
|
+
map_settings["properties"] = {}
|
|
30
|
+
map_settings["properties"].update(
|
|
31
|
+
{
|
|
32
|
+
"tilelayers": [TileLayer.get_default().json],
|
|
33
|
+
"datalayers": datalayer_data,
|
|
34
|
+
"urls": _urls_for_js(),
|
|
35
|
+
"STATIC_URL": settings.STATIC_URL,
|
|
36
|
+
"editMode": "disabled",
|
|
37
|
+
"hash": False,
|
|
38
|
+
"attributionControl": False,
|
|
39
|
+
"scrollWheelZoom": False,
|
|
40
|
+
"umapAttributionControl": False,
|
|
41
|
+
"noControl": True,
|
|
42
|
+
"umap_id": map_instance.pk,
|
|
43
|
+
"onLoadPanel": "none",
|
|
44
|
+
"captionBar": False,
|
|
45
|
+
"default_iconUrl": "%sumap/img/marker.png" % settings.STATIC_URL,
|
|
46
|
+
"slideshow": {},
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
map_settings["properties"].update(kwargs)
|
|
50
|
+
prefix = kwargs.pop("prefix", None) or "map"
|
|
51
|
+
page = kwargs.pop("page", None) or ""
|
|
55
52
|
unique_id = prefix + str(page) + "_" + str(map_instance.pk)
|
|
56
53
|
return {
|
|
57
54
|
"map_settings": json.dumps(map_settings),
|
|
58
55
|
"map": map_instance,
|
|
59
|
-
"unique_id": unique_id
|
|
56
|
+
"unique_id": unique_id,
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
|
|
@@ -73,7 +70,7 @@ def tilelayer_preview(tilelayer):
|
|
|
73
70
|
|
|
74
71
|
@register.filter
|
|
75
72
|
def notag(s):
|
|
76
|
-
return s.replace(
|
|
73
|
+
return s.replace("<", "<")
|
|
77
74
|
|
|
78
75
|
|
|
79
76
|
@register.simple_tag(takes_context=True)
|
|
@@ -86,5 +83,6 @@ def paginate_querystring(context, page):
|
|
|
86
83
|
@register.filter
|
|
87
84
|
def ipdb(what):
|
|
88
85
|
import ipdb
|
|
86
|
+
|
|
89
87
|
ipdb.set_trace()
|
|
90
|
-
return
|
|
88
|
+
return ""
|
umap/tests/base.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import json
|
|
2
1
|
import copy
|
|
2
|
+
import json
|
|
3
3
|
|
|
4
4
|
import factory
|
|
5
5
|
from django.contrib.auth import get_user_model
|
|
@@ -124,6 +124,7 @@ class DataLayerFactory(factory.django.DjangoModelFactory):
|
|
|
124
124
|
**DataLayerFactory.settings._defaults,
|
|
125
125
|
**kwargs["settings"],
|
|
126
126
|
}
|
|
127
|
+
data.setdefault("_umap_options", {})
|
|
127
128
|
data["_umap_options"]["name"] = kwargs["name"]
|
|
128
129
|
kwargs["geojson"] = ContentFile(json.dumps(data), "foo.json")
|
|
129
130
|
return kwargs
|
umap/tests/conftest.py
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from django.core.files.base import ContentFile
|
|
5
|
+
from playwright.sync_api import expect
|
|
6
|
+
|
|
7
|
+
from umap.models import Map, Pictogram
|
|
8
|
+
|
|
9
|
+
from ..base import DataLayerFactory
|
|
10
|
+
|
|
11
|
+
pytestmark = pytest.mark.django_db
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
DATALAYER_DATA = {
|
|
15
|
+
"type": "FeatureCollection",
|
|
16
|
+
"features": [
|
|
17
|
+
{
|
|
18
|
+
"type": "Feature",
|
|
19
|
+
"geometry": {
|
|
20
|
+
"type": "Point",
|
|
21
|
+
"coordinates": [13.6, 48.5],
|
|
22
|
+
},
|
|
23
|
+
"properties": {"name": "1st Point"},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "Feature",
|
|
27
|
+
"geometry": {
|
|
28
|
+
"type": "Point",
|
|
29
|
+
"coordinates": [13.7, 48.4],
|
|
30
|
+
},
|
|
31
|
+
"properties": {"name": "2d Point"},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "Feature",
|
|
35
|
+
"geometry": {
|
|
36
|
+
"type": "Point",
|
|
37
|
+
"coordinates": [13.5, 48.6],
|
|
38
|
+
},
|
|
39
|
+
"properties": {"name": "3d Point"},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_can_use_slideshow_manually(map, live_server, page):
|
|
46
|
+
map.settings["properties"]["slideshow"] = {"active": True, "delay": 5000}
|
|
47
|
+
map.save()
|
|
48
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA)
|
|
49
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
50
|
+
first_point = page.get_by_text("1st Point")
|
|
51
|
+
second_point = page.get_by_text("2d Point")
|
|
52
|
+
third_point = page.get_by_text("3d Point")
|
|
53
|
+
expect(first_point).to_be_hidden()
|
|
54
|
+
expect(second_point).to_be_hidden()
|
|
55
|
+
expect(third_point).to_be_hidden()
|
|
56
|
+
next_ = page.get_by_title("Zoom to the next")
|
|
57
|
+
expect(next_).to_be_visible()
|
|
58
|
+
next_.click()
|
|
59
|
+
expect(first_point).to_be_visible()
|
|
60
|
+
next_.click()
|
|
61
|
+
expect(first_point).to_be_hidden()
|
|
62
|
+
expect(second_point).to_be_visible()
|
|
63
|
+
next_.click()
|
|
64
|
+
expect(first_point).to_be_hidden()
|
|
65
|
+
expect(second_point).to_be_hidden()
|
|
66
|
+
expect(third_point).to_be_visible()
|
|
67
|
+
next_.click()
|
|
68
|
+
expect(first_point).to_be_visible()
|
|
69
|
+
expect(second_point).to_be_hidden()
|
|
70
|
+
expect(third_point).to_be_hidden()
|
umap/tests/settings.py
CHANGED
|
@@ -5,15 +5,17 @@ from umap.settings.base import * # pylint: disable=W0614,W0401
|
|
|
5
5
|
SECRET_KEY = "justfortests"
|
|
6
6
|
COMPRESS_ENABLED = False
|
|
7
7
|
FROM_EMAIL = "test@test.org"
|
|
8
|
-
EMAIL_BACKEND =
|
|
8
|
+
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
|
9
9
|
|
|
10
|
-
if "
|
|
10
|
+
if os.environ.get("GITHUB_ACTIONS", False) == "true":
|
|
11
11
|
DATABASES = {
|
|
12
12
|
"default": {
|
|
13
13
|
"ENGINE": "django.contrib.gis.db.backends.postgis",
|
|
14
|
-
"NAME": "
|
|
15
|
-
"
|
|
16
|
-
"
|
|
14
|
+
"NAME": "postgres",
|
|
15
|
+
"USER": "postgres",
|
|
16
|
+
"HOST": "localhost",
|
|
17
|
+
"PORT": 5432,
|
|
18
|
+
"PASSWORD": "postgres",
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
umap/tests/test_datalayer.py
CHANGED
|
@@ -3,9 +3,10 @@ import os
|
|
|
3
3
|
import pytest
|
|
4
4
|
from django.core.files.base import ContentFile
|
|
5
5
|
|
|
6
|
-
from .base import DataLayerFactory, MapFactory
|
|
7
6
|
from umap.models import DataLayer, Map
|
|
8
7
|
|
|
8
|
+
from .base import DataLayerFactory, MapFactory
|
|
9
|
+
|
|
9
10
|
pytestmark = pytest.mark.django_db
|
|
10
11
|
|
|
11
12
|
|
|
@@ -63,13 +64,13 @@ def test_should_remove_old_versions_on_save(datalayer, map, settings):
|
|
|
63
64
|
settings.UMAP_KEEP_VERSIONS = 3
|
|
64
65
|
root = datalayer.storage_root()
|
|
65
66
|
before = len(datalayer.geojson.storage.listdir(root)[1])
|
|
66
|
-
newer = f
|
|
67
|
-
medium = f
|
|
68
|
-
older = f
|
|
69
|
-
other = f
|
|
67
|
+
newer = f"{root}/{datalayer.pk}_1440924889.geojson"
|
|
68
|
+
medium = f"{root}/{datalayer.pk}_1440923687.geojson"
|
|
69
|
+
older = f"{root}/{datalayer.pk}_1440918637.geojson"
|
|
70
|
+
other = f"{root}/123456_1440918637.geojson"
|
|
70
71
|
for path in [medium, newer, older, other]:
|
|
71
72
|
datalayer.geojson.storage.save(path, ContentFile("{}"))
|
|
72
|
-
datalayer.geojson.storage.save(path +
|
|
73
|
+
datalayer.geojson.storage.save(path + ".gz", ContentFile("{}"))
|
|
73
74
|
assert len(datalayer.geojson.storage.listdir(root)[1]) == 8 + before
|
|
74
75
|
datalayer.save()
|
|
75
76
|
files = datalayer.geojson.storage.listdir(root)[1]
|
umap/tests/test_map.py
CHANGED
|
@@ -50,11 +50,13 @@ def test_editors_can_edit_if_status_editors(map, user):
|
|
|
50
50
|
assert map.can_edit(user)
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
def test_logged_in_user_should_be_allowed_for_anonymous_map_with_anonymous_edit_status(
|
|
53
|
+
def test_logged_in_user_should_be_allowed_for_anonymous_map_with_anonymous_edit_status(
|
|
54
|
+
map, user, rf
|
|
55
|
+
): # noqa
|
|
54
56
|
map.owner = None
|
|
55
57
|
map.edit_status = map.ANONYMOUS
|
|
56
58
|
map.save()
|
|
57
|
-
url = reverse(
|
|
59
|
+
url = reverse("map_update", kwargs={"map_id": map.pk})
|
|
58
60
|
request = rf.get(url)
|
|
59
61
|
request.user = user
|
|
60
62
|
assert map.can_edit(user, request)
|
|
@@ -70,7 +72,7 @@ def test_anonymous_user_should_not_be_allowed_for_anonymous_map(map, user, rf):
|
|
|
70
72
|
def test_clone_should_return_new_instance(map, user):
|
|
71
73
|
clone = map.clone()
|
|
72
74
|
assert map.pk != clone.pk
|
|
73
|
-
assert
|
|
75
|
+
assert "Clone of " + map.name == clone.name
|
|
74
76
|
assert map.settings == clone.settings
|
|
75
77
|
assert map.center == clone.center
|
|
76
78
|
assert map.zoom == clone.zoom
|
|
@@ -108,8 +110,7 @@ def test_clone_should_clone_datalayers_and_features_too(map, user, datalayer):
|
|
|
108
110
|
def test_publicmanager_should_get_only_public_maps(map, user, licence):
|
|
109
111
|
map.share_status = map.PUBLIC
|
|
110
112
|
open_map = MapFactory(owner=user, licence=licence, share_status=Map.OPEN)
|
|
111
|
-
private_map = MapFactory(owner=user, licence=licence,
|
|
112
|
-
share_status=Map.PRIVATE)
|
|
113
|
+
private_map = MapFactory(owner=user, licence=licence, share_status=Map.PRIVATE)
|
|
113
114
|
assert map in Map.public.all()
|
|
114
115
|
assert open_map not in Map.public.all()
|
|
115
116
|
assert private_map not in Map.public.all()
|
umap/tests/test_map_views.py
CHANGED
|
@@ -3,8 +3,8 @@ import json
|
|
|
3
3
|
import pytest
|
|
4
4
|
from django.contrib.auth import get_user_model
|
|
5
5
|
from django.core import mail
|
|
6
|
-
from django.urls import reverse
|
|
7
6
|
from django.core.signing import Signer
|
|
7
|
+
from django.urls import reverse
|
|
8
8
|
|
|
9
9
|
from umap.models import DataLayer, Map, Star
|
|
10
10
|
|
|
@@ -275,9 +275,7 @@ def test_owner_cannot_access_map_with_share_status_blocked(client, map):
|
|
|
275
275
|
assert response.status_code == 403
|
|
276
276
|
|
|
277
277
|
|
|
278
|
-
def test_non_editor_cannot_access_map_if_share_status_private(
|
|
279
|
-
client, map, user
|
|
280
|
-
): # noqa
|
|
278
|
+
def test_non_editor_cannot_access_map_if_share_status_private(client, map, user): # noqa
|
|
281
279
|
url = reverse("map", args=(map.slug, map.pk))
|
|
282
280
|
map.share_status = map.PRIVATE
|
|
283
281
|
map.save()
|
|
@@ -355,9 +353,7 @@ def test_anonymous_update_without_cookie_fails(client, anonymap, post_data): #
|
|
|
355
353
|
|
|
356
354
|
|
|
357
355
|
@pytest.mark.usefixtures("allow_anonymous")
|
|
358
|
-
def test_anonymous_update_with_cookie_should_work(
|
|
359
|
-
cookieclient, anonymap, post_data
|
|
360
|
-
): # noqa
|
|
356
|
+
def test_anonymous_update_with_cookie_should_work(cookieclient, anonymap, post_data): # noqa
|
|
361
357
|
url = reverse("map_update", kwargs={"map_id": anonymap.pk})
|
|
362
358
|
# POST only mendatory fields
|
|
363
359
|
name = "new map name"
|
|
@@ -438,9 +434,7 @@ def test_clone_anonymous_map_should_not_be_possible_if_user_is_not_allowed(
|
|
|
438
434
|
|
|
439
435
|
|
|
440
436
|
@pytest.mark.usefixtures("allow_anonymous")
|
|
441
|
-
def test_clone_map_should_be_possible_if_edit_status_is_anonymous(
|
|
442
|
-
client, anonymap
|
|
443
|
-
): # noqa
|
|
437
|
+
def test_clone_map_should_be_possible_if_edit_status_is_anonymous(client, anonymap): # noqa
|
|
444
438
|
assert Map.objects.count() == 1
|
|
445
439
|
url = reverse("map_clone", kwargs={"map_id": anonymap.pk})
|
|
446
440
|
anonymap.edit_status = anonymap.ANONYMOUS
|
umap/tests/test_tilelayer.py
CHANGED
|
@@ -6,16 +6,22 @@ pytestmark = pytest.mark.django_db
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def test_tilelayer_json():
|
|
9
|
-
tilelayer = TileLayerFactory(
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
tilelayer = TileLayerFactory(
|
|
10
|
+
attribution="Attribution",
|
|
11
|
+
maxZoom=19,
|
|
12
|
+
minZoom=0,
|
|
13
|
+
name="Name",
|
|
14
|
+
rank=1,
|
|
15
|
+
tms=True,
|
|
16
|
+
url_template="http://{s}.x.fr/{z}/{x}/{y}",
|
|
17
|
+
)
|
|
12
18
|
assert tilelayer.json == {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
"attribution": "Attribution",
|
|
20
|
+
"id": tilelayer.id,
|
|
21
|
+
"maxZoom": 19,
|
|
22
|
+
"minZoom": 0,
|
|
23
|
+
"name": "Name",
|
|
24
|
+
"rank": 1,
|
|
25
|
+
"tms": True,
|
|
26
|
+
"url_template": "http://{s}.x.fr/{z}/{x}/{y}",
|
|
21
27
|
}
|
umap/tests/test_views.py
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import socket
|
|
3
|
-
from datetime import date, timedelta
|
|
3
|
+
from datetime import date, datetime, timedelta
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
6
|
from django.conf import settings
|
|
7
7
|
from django.contrib.auth import get_user, get_user_model
|
|
8
|
-
from django.urls import reverse
|
|
9
8
|
from django.test import RequestFactory
|
|
9
|
+
from django.urls import reverse
|
|
10
|
+
from django.utils.timezone import make_aware
|
|
10
11
|
|
|
11
12
|
from umap import VERSION
|
|
12
13
|
from umap.views import validate_url
|
|
13
14
|
|
|
14
|
-
from .base import
|
|
15
|
+
from .base import MapFactory, UserFactory
|
|
15
16
|
|
|
16
17
|
User = get_user_model()
|
|
17
18
|
|
|
@@ -186,9 +187,9 @@ def test_stats_empty(client):
|
|
|
186
187
|
|
|
187
188
|
@pytest.mark.django_db
|
|
188
189
|
def test_stats_basic(client, map, datalayer, user2):
|
|
189
|
-
map.owner.last_login =
|
|
190
|
+
map.owner.last_login = make_aware(datetime.now())
|
|
190
191
|
map.owner.save()
|
|
191
|
-
user2.last_login =
|
|
192
|
+
user2.last_login = make_aware(datetime.now()) - timedelta(days=8)
|
|
192
193
|
user2.save()
|
|
193
194
|
response = client.get(reverse("stats"))
|
|
194
195
|
assert json.loads(response.content.decode()) == {
|
|
@@ -280,7 +281,7 @@ def test_user_dashboard_display_user_maps(client, map):
|
|
|
280
281
|
assert map.name in body
|
|
281
282
|
assert f"{map.get_absolute_url()}?edit" in body
|
|
282
283
|
assert f"{map.get_absolute_url()}?share" in body
|
|
283
|
-
assert f"{map.
|
|
284
|
+
assert f"/map/{map.pk}/download" in body
|
|
284
285
|
assert "Everyone (public)" in body
|
|
285
286
|
assert "Owner only" in body
|
|
286
287
|
|
umap/urls.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from django.conf import settings
|
|
2
|
-
from django.urls import include, path, re_path
|
|
3
2
|
from django.conf.urls.i18n import i18n_patterns
|
|
4
3
|
from django.conf.urls.static import static
|
|
5
4
|
from django.contrib import admin
|
|
@@ -7,16 +6,17 @@ from django.contrib.auth import views as auth_views
|
|
|
7
6
|
from django.contrib.auth.decorators import login_required
|
|
8
7
|
from django.contrib.staticfiles.storage import staticfiles_storage
|
|
9
8
|
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
|
9
|
+
from django.urls import include, path, re_path
|
|
10
10
|
from django.views.decorators.cache import cache_control, cache_page, never_cache
|
|
11
11
|
from django.views.decorators.csrf import ensure_csrf_cookie
|
|
12
12
|
from django.views.generic.base import RedirectView
|
|
13
13
|
|
|
14
14
|
from . import views
|
|
15
15
|
from .decorators import (
|
|
16
|
-
jsonize_view,
|
|
17
|
-
login_required_if_not_anonymous_allowed,
|
|
18
16
|
can_edit_map,
|
|
19
17
|
can_view_map,
|
|
18
|
+
jsonize_view,
|
|
19
|
+
login_required_if_not_anonymous_allowed,
|
|
20
20
|
)
|
|
21
21
|
from .utils import decorated_patterns
|
|
22
22
|
|
umap/utils.py
CHANGED
umap/views.py
CHANGED
|
@@ -3,16 +3,17 @@ import mimetypes
|
|
|
3
3
|
import os
|
|
4
4
|
import re
|
|
5
5
|
import socket
|
|
6
|
-
from datetime import
|
|
6
|
+
from datetime import datetime, timedelta
|
|
7
7
|
from http.client import InvalidURL
|
|
8
8
|
from pathlib import Path
|
|
9
|
-
from urllib.error import URLError
|
|
10
|
-
from urllib.parse import quote
|
|
9
|
+
from urllib.error import HTTPError, URLError
|
|
10
|
+
from urllib.parse import quote, urlparse
|
|
11
|
+
from urllib.request import Request, build_opener
|
|
11
12
|
|
|
12
13
|
from django.conf import settings
|
|
13
14
|
from django.contrib import messages
|
|
14
|
-
from django.contrib.auth import logout as do_logout
|
|
15
15
|
from django.contrib.auth import get_user_model
|
|
16
|
+
from django.contrib.auth import logout as do_logout
|
|
16
17
|
from django.contrib.gis.measure import D
|
|
17
18
|
from django.contrib.postgres.search import SearchQuery, SearchVector
|
|
18
19
|
from django.contrib.staticfiles.storage import staticfiles_storage
|
|
@@ -33,6 +34,7 @@ from django.shortcuts import get_object_or_404
|
|
|
33
34
|
from django.urls import reverse, reverse_lazy
|
|
34
35
|
from django.utils.encoding import smart_bytes
|
|
35
36
|
from django.utils.http import http_date
|
|
37
|
+
from django.utils.timezone import make_aware
|
|
36
38
|
from django.utils.translation import gettext as _
|
|
37
39
|
from django.utils.translation import to_locale
|
|
38
40
|
from django.views.decorators.cache import cache_control
|
|
@@ -45,13 +47,13 @@ from django.views.generic.list import ListView
|
|
|
45
47
|
|
|
46
48
|
from . import VERSION
|
|
47
49
|
from .forms import (
|
|
50
|
+
DEFAULT_CENTER,
|
|
48
51
|
DEFAULT_LATITUDE,
|
|
49
52
|
DEFAULT_LONGITUDE,
|
|
50
|
-
DEFAULT_CENTER,
|
|
51
|
-
DataLayerForm,
|
|
52
|
-
DataLayerPermissionsForm,
|
|
53
53
|
AnonymousDataLayerPermissionsForm,
|
|
54
54
|
AnonymousMapPermissionsForm,
|
|
55
|
+
DataLayerForm,
|
|
56
|
+
DataLayerPermissionsForm,
|
|
55
57
|
FlatErrorList,
|
|
56
58
|
MapSettingsForm,
|
|
57
59
|
SendLinkForm,
|
|
@@ -61,16 +63,6 @@ from .forms import (
|
|
|
61
63
|
from .models import DataLayer, Licence, Map, Pictogram, Star, TileLayer
|
|
62
64
|
from .utils import get_uri_template, gzip_file, is_ajax
|
|
63
65
|
|
|
64
|
-
try:
|
|
65
|
-
# python3
|
|
66
|
-
from urllib.parse import urlparse
|
|
67
|
-
from urllib.request import Request, build_opener
|
|
68
|
-
from urllib.error import HTTPError
|
|
69
|
-
except ImportError:
|
|
70
|
-
from urlparse import urlparse
|
|
71
|
-
from urllib2 import Request, HTTPError, build_opener
|
|
72
|
-
|
|
73
|
-
|
|
74
66
|
User = get_user_model()
|
|
75
67
|
|
|
76
68
|
|
|
@@ -140,8 +132,6 @@ class Home(PaginatorMixin, TemplateView, PublicMapsMixin):
|
|
|
140
132
|
demo_map = Map.public.get(pk=settings.UMAP_DEMO_PK)
|
|
141
133
|
except Map.DoesNotExist:
|
|
142
134
|
pass
|
|
143
|
-
else:
|
|
144
|
-
maps = maps.exclude(id=demo_map.pk)
|
|
145
135
|
|
|
146
136
|
showcase_map = None
|
|
147
137
|
if hasattr(settings, "UMAP_SHOWCASE_PK"):
|
|
@@ -149,8 +139,6 @@ class Home(PaginatorMixin, TemplateView, PublicMapsMixin):
|
|
|
149
139
|
showcase_map = Map.public.get(pk=settings.UMAP_SHOWCASE_PK)
|
|
150
140
|
except Map.DoesNotExist:
|
|
151
141
|
pass
|
|
152
|
-
else:
|
|
153
|
-
maps = maps.exclude(id=showcase_map.pk)
|
|
154
142
|
|
|
155
143
|
maps = self.paginate(maps, settings.UMAP_MAPS_PER_PAGE)
|
|
156
144
|
|
|
@@ -407,7 +395,7 @@ def _urls_for_js(urls=None):
|
|
|
407
395
|
"""
|
|
408
396
|
if urls is None:
|
|
409
397
|
# prevent circular import
|
|
410
|
-
from .urls import
|
|
398
|
+
from .urls import i18n_urls, urlpatterns
|
|
411
399
|
|
|
412
400
|
urls = [
|
|
413
401
|
url.name for url in urlpatterns + i18n_urls if getattr(url, "name", None)
|
|
@@ -1023,7 +1011,7 @@ class PictogramJSONList(ListView):
|
|
|
1023
1011
|
|
|
1024
1012
|
|
|
1025
1013
|
def stats(request):
|
|
1026
|
-
last_week =
|
|
1014
|
+
last_week = make_aware(datetime.now()) - timedelta(days=7)
|
|
1027
1015
|
return simple_json_response(
|
|
1028
1016
|
**{
|
|
1029
1017
|
"version": VERSION,
|
umap/wsgi.py
CHANGED
|
@@ -15,13 +15,13 @@ framework.
|
|
|
15
15
|
"""
|
|
16
16
|
import os
|
|
17
17
|
|
|
18
|
-
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
|
|
19
|
-
"umap.settings")
|
|
18
|
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "umap.settings")
|
|
20
19
|
|
|
21
20
|
# This application object is used by any WSGI server configured to use this
|
|
22
21
|
# file. This includes Django's development server, if the WSGI_APPLICATION
|
|
23
22
|
# setting points here.
|
|
24
23
|
from django.core.wsgi import get_wsgi_application
|
|
24
|
+
|
|
25
25
|
application = get_wsgi_application()
|
|
26
26
|
|
|
27
27
|
# Apply WSGI middleware here.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: umap-project
|
|
3
|
-
Version: 1.11.
|
|
3
|
+
Version: 1.11.1
|
|
4
4
|
Summary: Create maps with OpenStreetMap layers in a minute and embed them in your site.
|
|
5
5
|
Author-email: Yohan Boniface <yb@enix.org>
|
|
6
6
|
Maintainer-email: David Larlet <david@larlet.fr>
|
|
@@ -11,37 +11,39 @@ Classifier: Intended Audience :: Developers
|
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
13
13
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
18
14
|
Classifier: Programming Language :: Python :: 3.8
|
|
19
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
19
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
20
|
Requires-Python: >=3.8
|
|
23
21
|
Requires-Dist: django-agnocomplete==2.2.0
|
|
24
22
|
Requires-Dist: django-compressor==4.3.1
|
|
25
23
|
Requires-Dist: django-environ==0.10.0
|
|
26
24
|
Requires-Dist: django-probes==1.7.0
|
|
27
|
-
Requires-Dist: django
|
|
25
|
+
Requires-Dist: django<5,>=4.2
|
|
28
26
|
Requires-Dist: pillow==10.0.1
|
|
29
27
|
Requires-Dist: psycopg2==2.9.6
|
|
30
28
|
Requires-Dist: requests==2.31.0
|
|
31
29
|
Requires-Dist: social-auth-app-django==5.2.0
|
|
32
30
|
Requires-Dist: social-auth-core==4.4.2
|
|
33
31
|
Provides-Extra: dev
|
|
34
|
-
Requires-Dist: black==23.3.0; extra == 'dev'
|
|
35
32
|
Requires-Dist: djlint==1.31.0; extra == 'dev'
|
|
36
33
|
Requires-Dist: hatch==1.7.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: isort==5.12; extra == 'dev'
|
|
37
35
|
Requires-Dist: mkdocs==1.5.2; extra == 'dev'
|
|
36
|
+
Requires-Dist: pymdown-extensions==10.4; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff==0.1.6; extra == 'dev'
|
|
38
|
+
Requires-Dist: vermin==1.5.2; extra == 'dev'
|
|
38
39
|
Provides-Extra: docker
|
|
39
40
|
Requires-Dist: uwsgi==2.0.21; extra == 'docker'
|
|
40
41
|
Provides-Extra: test
|
|
41
42
|
Requires-Dist: factory-boy==3.2.1; extra == 'test'
|
|
42
|
-
Requires-Dist: playwright
|
|
43
|
+
Requires-Dist: playwright<2,>=1.39; extra == 'test'
|
|
43
44
|
Requires-Dist: pytest-django==4.5.2; extra == 'test'
|
|
44
|
-
Requires-Dist: pytest-playwright
|
|
45
|
+
Requires-Dist: pytest-playwright<1,>=0.4.3; extra == 'test'
|
|
46
|
+
Requires-Dist: pytest-xdist<4,>=3.5.0; extra == 'test'
|
|
45
47
|
Requires-Dist: pytest==6.2.5; extra == 'test'
|
|
46
48
|
Description-Content-Type: text/markdown
|
|
47
49
|
|