imio.smartweb.core 1.2.85__py3-none-any.whl → 1.2.86__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.
- imio/smartweb/core/contents/sections/configure.zcml +18 -0
- imio/smartweb/core/contents/sections/events/view.py +5 -0
- imio/smartweb/core/contents/sections/macros.pt +6 -0
- imio/smartweb/core/contents/sections/news/view.py +5 -0
- imio/smartweb/core/contents/sections/views.py +8 -0
- imio/smartweb/core/tests/resources/json_news_raw_mock.json +361 -0
- imio/smartweb/core/tests/test_utils.py +19 -0
- imio/smartweb/core/utils.py +18 -0
- {imio.smartweb.core-1.2.85.dist-info → imio.smartweb.core-1.2.86.dist-info}/METADATA +11 -1
- {imio.smartweb.core-1.2.85.dist-info → imio.smartweb.core-1.2.86.dist-info}/RECORD +16 -15
- /imio.smartweb.core-1.2.85-py3.12-nspkg.pth → /imio.smartweb.core-1.2.86-py3.12-nspkg.pth +0 -0
- {imio.smartweb.core-1.2.85.dist-info → imio.smartweb.core-1.2.86.dist-info}/LICENSE.GPL +0 -0
- {imio.smartweb.core-1.2.85.dist-info → imio.smartweb.core-1.2.86.dist-info}/LICENSE.rst +0 -0
- {imio.smartweb.core-1.2.85.dist-info → imio.smartweb.core-1.2.86.dist-info}/WHEEL +0 -0
- {imio.smartweb.core-1.2.85.dist-info → imio.smartweb.core-1.2.86.dist-info}/namespace_packages.txt +0 -0
- {imio.smartweb.core-1.2.85.dist-info → imio.smartweb.core-1.2.86.dist-info}/top_level.txt +0 -0
@@ -54,6 +54,24 @@
|
|
54
54
|
layer="imio.smartweb.core.interfaces.IImioSmartwebCoreLayer"
|
55
55
|
/>
|
56
56
|
|
57
|
+
<browser:page
|
58
|
+
name="refresh_modification_date"
|
59
|
+
for="imio.smartweb.core.contents.ISectionNews"
|
60
|
+
class=".views.SectionView"
|
61
|
+
attribute="refresh_modification_date"
|
62
|
+
permission="cmf.ModifyPortalContent"
|
63
|
+
layer="imio.smartweb.core.interfaces.IImioSmartwebCoreLayer"
|
64
|
+
/>
|
65
|
+
|
66
|
+
<browser:page
|
67
|
+
name="refresh_modification_date"
|
68
|
+
for="imio.smartweb.core.contents.ISectionEvents"
|
69
|
+
class=".views.SectionView"
|
70
|
+
attribute="refresh_modification_date"
|
71
|
+
permission="cmf.ModifyPortalContent"
|
72
|
+
layer="imio.smartweb.core.interfaces.IImioSmartwebCoreLayer"
|
73
|
+
/>
|
74
|
+
|
57
75
|
<browser:page
|
58
76
|
for="*"
|
59
77
|
name="getsizes"
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
from datetime import date
|
4
4
|
from dateutil.parser import parse
|
5
|
+
from DateTime import DateTime
|
5
6
|
from imio.smartweb.common.utils import translate_vocabulary_term
|
6
7
|
from imio.smartweb.core.config import EVENTS_URL
|
7
8
|
from imio.smartweb.core.contents.sections.views import CarouselOrTableSectionView
|
@@ -9,6 +10,7 @@ from imio.smartweb.core.contents.sections.views import HashableJsonSectionView
|
|
9
10
|
from imio.smartweb.core.utils import batch_results
|
10
11
|
from imio.smartweb.core.utils import get_json
|
11
12
|
from imio.smartweb.core.utils import hash_md5
|
13
|
+
from imio.smartweb.core.utils import remove_cache_key
|
12
14
|
from plone import api
|
13
15
|
from Products.CMFPlone.utils import normalizeString
|
14
16
|
|
@@ -26,6 +28,7 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
26
28
|
selected_item = "&".join(
|
27
29
|
[f"UID={event_uid}" for event_uid in specific_related_events]
|
28
30
|
)
|
31
|
+
modified_hash = hash_md5(str(self.context.modification_date))
|
29
32
|
params = [
|
30
33
|
selected_item,
|
31
34
|
"metadata_fields=container_uid",
|
@@ -37,6 +40,7 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
37
40
|
"metadata_fields=has_leadimage",
|
38
41
|
"metadata_fields=modified",
|
39
42
|
"metadata_fields=UID",
|
43
|
+
f"cache_key={modified_hash}",
|
40
44
|
f"event_dates.query={today}",
|
41
45
|
"event_dates.range=min",
|
42
46
|
f"b_size={max_items}",
|
@@ -50,6 +54,7 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
50
54
|
]
|
51
55
|
url = "{}/@events?{}".format(EVENTS_URL, "&".join(params))
|
52
56
|
self.json_data = get_json(url)
|
57
|
+
self.json_data = remove_cache_key(self.json_data)
|
53
58
|
self.refresh_modification_date()
|
54
59
|
if self.json_data is None or len(self.json_data.get("items", [])) == 0:
|
55
60
|
return []
|
@@ -98,6 +98,12 @@
|
|
98
98
|
</span>
|
99
99
|
</tal:dates>
|
100
100
|
|
101
|
+
<tal:if tal:condition="python:context.portal_type in ['imio.smartweb.SectionNews', 'imio.smartweb.SectionEvents']">
|
102
|
+
<span class="glyphicon-repeat glyphicon"></span>
|
103
|
+
<a tal:attributes="href string:${context/absolute_url}/refresh_modification_date"
|
104
|
+
i18n:translate="">Refresh section</a>
|
105
|
+
</tal:if>
|
106
|
+
|
101
107
|
</div>
|
102
108
|
</div>
|
103
109
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
from DateTime import DateTime
|
3
4
|
from imio.smartweb.common.utils import translate_vocabulary_term
|
4
5
|
from imio.smartweb.core.config import NEWS_URL
|
5
6
|
from imio.smartweb.core.contents.sections.views import CarouselOrTableSectionView
|
@@ -7,6 +8,7 @@ from imio.smartweb.core.contents.sections.views import HashableJsonSectionView
|
|
7
8
|
from imio.smartweb.core.utils import batch_results
|
8
9
|
from imio.smartweb.core.utils import get_json
|
9
10
|
from imio.smartweb.core.utils import hash_md5
|
11
|
+
from imio.smartweb.core.utils import remove_cache_key
|
10
12
|
from plone import api
|
11
13
|
from Products.CMFPlone.utils import normalizeString
|
12
14
|
|
@@ -23,6 +25,7 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
23
25
|
selected_item = "&".join(
|
24
26
|
[f"UID={newsitem_uid}" for newsitem_uid in specific_related_newsitems]
|
25
27
|
)
|
28
|
+
modified_hash = hash_md5(str(self.context.modification_date))
|
26
29
|
params = [
|
27
30
|
selected_item,
|
28
31
|
"portal_type=imio.news.NewsItem",
|
@@ -34,6 +37,7 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
34
37
|
"metadata_fields=modified",
|
35
38
|
"metadata_fields=effective",
|
36
39
|
"metadata_fields=UID",
|
40
|
+
f"cache_key={modified_hash}",
|
37
41
|
f"sort_limit={max_items}",
|
38
42
|
]
|
39
43
|
current_lang = api.portal.get_current_language()[:2]
|
@@ -46,6 +50,7 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
46
50
|
]
|
47
51
|
url = "{}/@search?{}".format(NEWS_URL, "&".join(params))
|
48
52
|
self.json_data = get_json(url)
|
53
|
+
self.json_data = remove_cache_key(self.json_data)
|
49
54
|
self.refresh_modification_date()
|
50
55
|
if self.json_data is None or len(self.json_data.get("items", [])) == 0:
|
51
56
|
return []
|
@@ -58,6 +58,14 @@ class SectionView(BrowserView):
|
|
58
58
|
api.portal.show_message(_("Section title has been shown"), self.request)
|
59
59
|
self.redirect_to_section(self.context.id)
|
60
60
|
|
61
|
+
def refresh_modification_date(self):
|
62
|
+
alsoProvides(self.request, IDisableCSRFProtection)
|
63
|
+
modified(self.context)
|
64
|
+
api.portal.show_message(
|
65
|
+
_("Section modification date has been refreshed"), self.request
|
66
|
+
)
|
67
|
+
self.redirect_to_section(self.context.id)
|
68
|
+
|
61
69
|
@property
|
62
70
|
def display_container_title(self):
|
63
71
|
return False
|
@@ -0,0 +1,361 @@
|
|
1
|
+
{
|
2
|
+
"@id": "http://localhost:8080/Plone/@search?selected_news_folders=3b1a50f17b7047f7bb0fc75cf5ad7329&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=UID&metadata_fields=container_uid&metadata_fields=local_category&metadata_fields=modified&metadata_fields=effective&cache_key=0158244a017b01923cecc32d0613e46e",
|
3
|
+
"batching": {
|
4
|
+
"@id": "http://localhost:8080/Plone/@search?selected_news_folders=3b1a50f17b7047f7bb0fc75cf5ad7329&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=UID&metadata_fields=container_uid&metadata_fields=local_category&metadata_fields=modified&metadata_fields=effective&cache_key=0158244a017b01923cecc32d0613e46e&sort_limit=9&sort_on=effective&sort_order=descending",
|
5
|
+
"first": "http://localhost:8080/Plone/@search?b_start=0&selected_news_folders=3b1a50f17b7047f7bb0fc75cf5ad7329&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=UID&metadata_fields=container_uid&metadata_fields=local_category&metadata_fields=modified&metadata_fields=effective&cache_key=0158244a017b01923cecc32d0613e46e&sort_limit=9&sort_on=effective&sort_order=descending",
|
6
|
+
"last": "http://localhost:8080/Plone/@search?b_start=25&selected_news_folders=3b1a50f17b7047f7bb0fc75cf5ad7329&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=UID&metadata_fields=container_uid&metadata_fields=local_category&metadata_fields=modified&metadata_fields=effective&cache_key=0158244a017b01923cecc32d0613e46e&sort_limit=9&sort_on=effective&sort_order=descending",
|
7
|
+
"next": "http://localhost:8080/Plone/@search?b_start=25&selected_news_folders=3b1a50f17b7047f7bb0fc75cf5ad7329&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=topics&metadata_fields=has_leadimage&metadata_fields=UID&metadata_fields=container_uid&metadata_fields=local_category&metadata_fields=modified&metadata_fields=effective&cache_key=0158244a017b01923cecc32d0613e46e&sort_limit=9&sort_on=effective&sort_order=descending"
|
8
|
+
},
|
9
|
+
"items": [
|
10
|
+
{
|
11
|
+
"@id": "http://localhost:8080/Plone/belleville/commune/66ae76b8f652426089e237ee603386a2",
|
12
|
+
"@type": "imio.news.NewsItem",
|
13
|
+
"UID": "0505534d249c48a2b99713a7ac211ebe",
|
14
|
+
"category_title": null,
|
15
|
+
"container_uid": "f110a339e3b84561bc61962a9742b705",
|
16
|
+
"description": "Cybers\u00e9curit\u00e9 et e-gouvernement seront au coeur de l'iMio Day 2025, journ\u00e9e de conf\u00e9rences et d'ateliers interactifs pour les pouvoirs locaux wallons.",
|
17
|
+
"effective": "2025-01-30T07:30:00+00:00",
|
18
|
+
"has_leadimage": true,
|
19
|
+
"image_field": null,
|
20
|
+
"image_scales": {
|
21
|
+
"image": [
|
22
|
+
{
|
23
|
+
"content-type": "image/jpeg",
|
24
|
+
"download": "@@images/image-800-63339b1cf1fa99e483e2d22118838976.jpeg",
|
25
|
+
"filename": "imio-day-news.jpg",
|
26
|
+
"height": 567,
|
27
|
+
"scales": {
|
28
|
+
"carre_affiche": {
|
29
|
+
"download": "@@images/image-750-9b875e4ec5fac53cc1c3819436f9f6de.jpeg",
|
30
|
+
"height": 531,
|
31
|
+
"width": 750
|
32
|
+
},
|
33
|
+
"carre_liste": {
|
34
|
+
"download": "@@images/image-167-75c17e711259f2bf690953f8da94e166.jpeg",
|
35
|
+
"height": 118,
|
36
|
+
"width": 167
|
37
|
+
},
|
38
|
+
"carre_vignette": {
|
39
|
+
"download": "@@images/image-430-0fe2e5e1f941ab0a06f168e36f0e2354.jpeg",
|
40
|
+
"height": 304,
|
41
|
+
"width": 430
|
42
|
+
},
|
43
|
+
"icon": {
|
44
|
+
"download": "@@images/image-32-63570e5e551edbf00756dc83f3c175b8.jpeg",
|
45
|
+
"height": 22,
|
46
|
+
"width": 32
|
47
|
+
},
|
48
|
+
"large": {
|
49
|
+
"download": "@@images/image-768-6ff498338f7766f67c1706aab38c499a.jpeg",
|
50
|
+
"height": 544,
|
51
|
+
"width": 768
|
52
|
+
},
|
53
|
+
"listing": {
|
54
|
+
"download": "@@images/image-16-19207497efaeee9c1cbcfacc8b34a0ca.jpeg",
|
55
|
+
"height": 11,
|
56
|
+
"width": 16
|
57
|
+
},
|
58
|
+
"mini": {
|
59
|
+
"download": "@@images/image-200-e051498e2896e0b0e0e238f390d7e0ad.jpeg",
|
60
|
+
"height": 141,
|
61
|
+
"width": 200
|
62
|
+
},
|
63
|
+
"paysage_affiche": {
|
64
|
+
"download": "@@images/image-750-1bed9c113c6fb72251eece6b3715ad12.jpeg",
|
65
|
+
"height": 448,
|
66
|
+
"width": 632
|
67
|
+
},
|
68
|
+
"paysage_liste": {
|
69
|
+
"download": "@@images/image-167-cb1fbeb03984f81f82331d95f7220b62.jpeg",
|
70
|
+
"height": 100,
|
71
|
+
"width": 141
|
72
|
+
},
|
73
|
+
"paysage_vignette": {
|
74
|
+
"download": "@@images/image-430-eb01854c72f779c0e1af385cbe70de06.jpeg",
|
75
|
+
"height": 257,
|
76
|
+
"width": 363
|
77
|
+
},
|
78
|
+
"portrait_affiche": {
|
79
|
+
"download": "@@images/image-448-3bdd59fe0bc2c51557a362bcc7d1698e.jpeg",
|
80
|
+
"height": 317,
|
81
|
+
"width": 448
|
82
|
+
},
|
83
|
+
"portrait_liste": {
|
84
|
+
"download": "@@images/image-222-70fc7ff043421cbe10a50b9149bb40f0.jpeg",
|
85
|
+
"height": 157,
|
86
|
+
"width": 222
|
87
|
+
},
|
88
|
+
"portrait_vignette": {
|
89
|
+
"download": "@@images/image-448-3bdd59fe0bc2c51557a362bcc7d1698e.jpeg",
|
90
|
+
"height": 317,
|
91
|
+
"width": 448
|
92
|
+
},
|
93
|
+
"preview": {
|
94
|
+
"download": "@@images/image-400-592dedf61a5e8cd7e32cd309db88ccdc.jpeg",
|
95
|
+
"height": 283,
|
96
|
+
"width": 400
|
97
|
+
},
|
98
|
+
"thumb": {
|
99
|
+
"download": "@@images/image-128-558227cc08bb21c7d0b1ffa9bf0e27bd.jpeg",
|
100
|
+
"height": 90,
|
101
|
+
"width": 128
|
102
|
+
},
|
103
|
+
"tile": {
|
104
|
+
"download": "@@images/image-64-30d47052707adb48f3ec0e8b2b31b4a9.jpeg",
|
105
|
+
"height": 45,
|
106
|
+
"width": 64
|
107
|
+
}
|
108
|
+
},
|
109
|
+
"size": 222334,
|
110
|
+
"width": 800
|
111
|
+
}
|
112
|
+
]
|
113
|
+
},
|
114
|
+
"local_category": null,
|
115
|
+
"modified": "2025-01-30T07:47:51+00:00",
|
116
|
+
"review_state": "published",
|
117
|
+
"title": "Ne ratez pas l'iMio Day du 13 f\u00e9vrier 2025 !",
|
118
|
+
"topics": null,
|
119
|
+
"type_title": "Actualit\u00e9",
|
120
|
+
"usefull_container_id": "commune",
|
121
|
+
"usefull_container_title": "Actualit\u00e9s de la commune"
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"@id": "http://localhost:8080/Plone/belleville/commune/0767749eaf85441a8179303768f48ef2",
|
125
|
+
"@type": "imio.news.NewsItem",
|
126
|
+
"UID": "0767749eaf85441a8179303768f48ef2",
|
127
|
+
"category_title": null,
|
128
|
+
"container_uid": "f110a339e3b84561bc61962a9742b705",
|
129
|
+
"description": "",
|
130
|
+
"effective": "2025-01-14T14:07:06+00:00",
|
131
|
+
"has_leadimage": true,
|
132
|
+
"image_field": null,
|
133
|
+
"image_scales": {
|
134
|
+
"image": [
|
135
|
+
{
|
136
|
+
"content-type": "image/jpeg",
|
137
|
+
"download": "@@images/image-1920-0d28d8fef7ef4c6f46a185fd428a8a01.jpeg",
|
138
|
+
"filename": "motion-blur-g10d7a49bc_1920.jpg",
|
139
|
+
"height": 1279,
|
140
|
+
"scales": {
|
141
|
+
"banner": {
|
142
|
+
"download": "@@images/image-1920-1a0c7ac40882f46d5e5bd82542cd2bc3.jpeg",
|
143
|
+
"height": 1279,
|
144
|
+
"width": 1920
|
145
|
+
},
|
146
|
+
"carre_affiche": {
|
147
|
+
"download": "@@images/image-750-e2037c7eadaf2518e6fabe9c55570a43.jpeg",
|
148
|
+
"height": 499,
|
149
|
+
"width": 750
|
150
|
+
},
|
151
|
+
"carre_liste": {
|
152
|
+
"download": "@@images/image-167-b28c2562e2a234fb758a272e8cd2cfb8.jpeg",
|
153
|
+
"height": 111,
|
154
|
+
"width": 167
|
155
|
+
},
|
156
|
+
"carre_vignette": {
|
157
|
+
"download": "@@images/image-430-406b324c9324298c12da47de2e809bd3.jpeg",
|
158
|
+
"height": 286,
|
159
|
+
"width": 430
|
160
|
+
},
|
161
|
+
"icon": {
|
162
|
+
"download": "@@images/image-32-6fe71d6d2b377d659dbd031d3640eee8.jpeg",
|
163
|
+
"height": 21,
|
164
|
+
"width": 32
|
165
|
+
},
|
166
|
+
"large": {
|
167
|
+
"download": "@@images/image-768-c533dfefc4dab171ab67f91675346f37.jpeg",
|
168
|
+
"height": 511,
|
169
|
+
"width": 768
|
170
|
+
},
|
171
|
+
"listing": {
|
172
|
+
"download": "@@images/image-16-203636a735d8132c4e0be847b85343a6.jpeg",
|
173
|
+
"height": 10,
|
174
|
+
"width": 16
|
175
|
+
},
|
176
|
+
"mini": {
|
177
|
+
"download": "@@images/image-200-73a7abcb2d44f086523030a10902a972.jpeg",
|
178
|
+
"height": 133,
|
179
|
+
"width": 200
|
180
|
+
},
|
181
|
+
"paysage_affiche": {
|
182
|
+
"download": "@@images/image-750-4d6fa1004b2c148eaa85074c51bd26d8.jpeg",
|
183
|
+
"height": 448,
|
184
|
+
"width": 673
|
185
|
+
},
|
186
|
+
"paysage_liste": {
|
187
|
+
"download": "@@images/image-167-aa74a3ecc21959d849aa60e795b00cad.jpeg",
|
188
|
+
"height": 100,
|
189
|
+
"width": 150
|
190
|
+
},
|
191
|
+
"paysage_vignette": {
|
192
|
+
"download": "@@images/image-430-28ef12d29b66bb5c65b6f70b58943fc1.jpeg",
|
193
|
+
"height": 257,
|
194
|
+
"width": 386
|
195
|
+
},
|
196
|
+
"portrait_affiche": {
|
197
|
+
"download": "@@images/image-448-8613bdd585e702eba2a4a4d5fa66b013.jpeg",
|
198
|
+
"height": 298,
|
199
|
+
"width": 448
|
200
|
+
},
|
201
|
+
"portrait_liste": {
|
202
|
+
"download": "@@images/image-222-6f24b9a8a93b3d30e2dfb352962e9937.jpeg",
|
203
|
+
"height": 147,
|
204
|
+
"width": 222
|
205
|
+
},
|
206
|
+
"portrait_vignette": {
|
207
|
+
"download": "@@images/image-448-8613bdd585e702eba2a4a4d5fa66b013.jpeg",
|
208
|
+
"height": 298,
|
209
|
+
"width": 448
|
210
|
+
},
|
211
|
+
"preview": {
|
212
|
+
"download": "@@images/image-400-86c0a78163a36fb1fccff82b0cd58781.jpeg",
|
213
|
+
"height": 266,
|
214
|
+
"width": 400
|
215
|
+
},
|
216
|
+
"thumb": {
|
217
|
+
"download": "@@images/image-128-9e55ef22fea075a0211c335f39cdd91a.jpeg",
|
218
|
+
"height": 85,
|
219
|
+
"width": 128
|
220
|
+
},
|
221
|
+
"tile": {
|
222
|
+
"download": "@@images/image-64-570f49fe16b3a55e953eb555e8002cc5.jpeg",
|
223
|
+
"height": 42,
|
224
|
+
"width": 64
|
225
|
+
}
|
226
|
+
},
|
227
|
+
"size": 261649,
|
228
|
+
"width": 1920
|
229
|
+
}
|
230
|
+
]
|
231
|
+
},
|
232
|
+
"local_category": null,
|
233
|
+
"modified": "2025-01-14T14:07:06+00:00",
|
234
|
+
"review_state": "published",
|
235
|
+
"title": "Le Caching Web : Optimisation des Performances",
|
236
|
+
"topics": null,
|
237
|
+
"type_title": "Actualit\u00e9",
|
238
|
+
"usefull_container_id": "commune",
|
239
|
+
"usefull_container_title": "Actualit\u00e9s de la commune"
|
240
|
+
},
|
241
|
+
{
|
242
|
+
"@id": "http://localhost:8080/Plone/belleville/commune/01678b36a5c14de08c0048a4e60960b6",
|
243
|
+
"@type": "imio.news.NewsItem",
|
244
|
+
"UID": "01678b36a5c14de08c0048a4e60960b6",
|
245
|
+
"category_title": null,
|
246
|
+
"container_uid": "f110a339e3b84561bc61962a9742b705",
|
247
|
+
"description": "Cette actualit\u00e9 est vraiment urgente",
|
248
|
+
"effective": "2025-01-14T12:40:00+00:00",
|
249
|
+
"has_leadimage": true,
|
250
|
+
"image_field": null,
|
251
|
+
"image_scales": {
|
252
|
+
"image": [
|
253
|
+
{
|
254
|
+
"content-type": "image/jpeg",
|
255
|
+
"download": "@@images/image-1920-bdb33a542ba3c3fa6a22a42b852d2ef5.jpeg",
|
256
|
+
"filename": "meadow-g92ecd61e0_1920.jpg",
|
257
|
+
"height": 1280,
|
258
|
+
"scales": {
|
259
|
+
"banner": {
|
260
|
+
"download": "@@images/image-1920-b65b0609f5d6758fbacbde2b23557b06.jpeg",
|
261
|
+
"height": 1280,
|
262
|
+
"width": 1920
|
263
|
+
},
|
264
|
+
"carre_affiche": {
|
265
|
+
"download": "@@images/image-750-b1582bdedef66b480c23485c7127b6be.jpeg",
|
266
|
+
"height": 500,
|
267
|
+
"width": 750
|
268
|
+
},
|
269
|
+
"carre_liste": {
|
270
|
+
"download": "@@images/image-167-c8a42e802696e7482095aa488c4394f7.jpeg",
|
271
|
+
"height": 111,
|
272
|
+
"width": 167
|
273
|
+
},
|
274
|
+
"carre_vignette": {
|
275
|
+
"download": "@@images/image-430-142b5f6c63148c8770b9fea68fe24df3.jpeg",
|
276
|
+
"height": 286,
|
277
|
+
"width": 430
|
278
|
+
},
|
279
|
+
"icon": {
|
280
|
+
"download": "@@images/image-32-6cc24c2d5ace4616b574db5b932a87ef.jpeg",
|
281
|
+
"height": 21,
|
282
|
+
"width": 32
|
283
|
+
},
|
284
|
+
"large": {
|
285
|
+
"download": "@@images/image-768-8f92dbb808d056cb5b1d5181b6d8194b.jpeg",
|
286
|
+
"height": 512,
|
287
|
+
"width": 768
|
288
|
+
},
|
289
|
+
"listing": {
|
290
|
+
"download": "@@images/image-16-b8e4b8a391de69be69ce347ffb23d3c7.jpeg",
|
291
|
+
"height": 10,
|
292
|
+
"width": 16
|
293
|
+
},
|
294
|
+
"mini": {
|
295
|
+
"download": "@@images/image-200-b8ae70b47662de08ad2ddad51ecf0729.jpeg",
|
296
|
+
"height": 133,
|
297
|
+
"width": 200
|
298
|
+
},
|
299
|
+
"paysage_affiche": {
|
300
|
+
"download": "@@images/image-750-109a22ed750b2f9cd2d37e8fa5031ed6.jpeg",
|
301
|
+
"height": 448,
|
302
|
+
"width": 672
|
303
|
+
},
|
304
|
+
"paysage_liste": {
|
305
|
+
"download": "@@images/image-167-d81cf3ac0f9b0d6c6d153e35733a4719.jpeg",
|
306
|
+
"height": 100,
|
307
|
+
"width": 150
|
308
|
+
},
|
309
|
+
"paysage_vignette": {
|
310
|
+
"download": "@@images/image-430-6c5129a3abcac460e8da4fd71de2f6f4.jpeg",
|
311
|
+
"height": 257,
|
312
|
+
"width": 386
|
313
|
+
},
|
314
|
+
"portrait_affiche": {
|
315
|
+
"download": "@@images/image-448-6c15b19eb0947c6532e21681494e9ab4.jpeg",
|
316
|
+
"height": 298,
|
317
|
+
"width": 448
|
318
|
+
},
|
319
|
+
"portrait_liste": {
|
320
|
+
"download": "@@images/image-222-98bce7ad7e0a55b3cd5b199e1e9e7f1f.jpeg",
|
321
|
+
"height": 148,
|
322
|
+
"width": 222
|
323
|
+
},
|
324
|
+
"portrait_vignette": {
|
325
|
+
"download": "@@images/image-448-6c15b19eb0947c6532e21681494e9ab4.jpeg",
|
326
|
+
"height": 298,
|
327
|
+
"width": 448
|
328
|
+
},
|
329
|
+
"preview": {
|
330
|
+
"download": "@@images/image-400-d9d488dd1677386f0107d79c1565f5ae.jpeg",
|
331
|
+
"height": 266,
|
332
|
+
"width": 400
|
333
|
+
},
|
334
|
+
"thumb": {
|
335
|
+
"download": "@@images/image-128-0419c932370ccfdc495871dd991a9b55.jpeg",
|
336
|
+
"height": 85,
|
337
|
+
"width": 128
|
338
|
+
},
|
339
|
+
"tile": {
|
340
|
+
"download": "@@images/image-64-f5524890af469fd078ca929b5387130b.jpeg",
|
341
|
+
"height": 42,
|
342
|
+
"width": 64
|
343
|
+
}
|
344
|
+
},
|
345
|
+
"size": 759049,
|
346
|
+
"width": 1920
|
347
|
+
}
|
348
|
+
]
|
349
|
+
},
|
350
|
+
"local_category": null,
|
351
|
+
"modified": "2025-02-07T10:09:10+00:00",
|
352
|
+
"review_state": "published",
|
353
|
+
"title": "Une actualit\u00e9 tr\u00e8s urgente.",
|
354
|
+
"topics": null,
|
355
|
+
"type_title": "Actualit\u00e9",
|
356
|
+
"usefull_container_id": "commune",
|
357
|
+
"usefull_container_title": "Actualit\u00e9s de la commune"
|
358
|
+
}
|
359
|
+
],
|
360
|
+
"items_total": 51
|
361
|
+
}
|
@@ -6,6 +6,8 @@ from imio.smartweb.core.testing import ImioSmartwebTestCase
|
|
6
6
|
from imio.smartweb.core.tests.utils import make_named_image
|
7
7
|
from imio.smartweb.core.utils import batch_results
|
8
8
|
from imio.smartweb.core.utils import get_scale_url
|
9
|
+
from imio.smartweb.core.utils import remove_cache_key
|
10
|
+
from imio.smartweb.core.tests.utils import get_json
|
9
11
|
from plone import api
|
10
12
|
from plone.app.testing import setRoles
|
11
13
|
from plone.app.testing import TEST_USER_ID
|
@@ -92,3 +94,20 @@ class TestUtils(ImioSmartwebTestCase):
|
|
92
94
|
get_scale_url(brain, self.request, "image", "portrait_affiche", "portrait"),
|
93
95
|
"http://nohost/plone/page/@@images/image/portrait_affiche?cache_key=78fd1bab198354b6877aed44e2ea0b4d",
|
94
96
|
)
|
97
|
+
|
98
|
+
def test_remove_cache_key(self):
|
99
|
+
self.json_news = get_json("resources/json_news_raw_mock.json")
|
100
|
+
self.assertIn("cache_key", self.json_news["@id"])
|
101
|
+
for key in ["@id", "first", "last", "next"]:
|
102
|
+
if key in self.json_news["batching"] and isinstance(
|
103
|
+
self.json_news["batching"][key], str
|
104
|
+
):
|
105
|
+
self.assertIn("cache_key", self.json_news["batching"][key])
|
106
|
+
self.json_news = remove_cache_key(self.json_news)
|
107
|
+
|
108
|
+
self.assertNotIn("cache_key", self.json_news["@id"])
|
109
|
+
for key in ["@id", "first", "last", "next"]:
|
110
|
+
if key in self.json_news["batching"] and isinstance(
|
111
|
+
self.json_news["batching"][key], str
|
112
|
+
):
|
113
|
+
self.assertNotIn("cache_key", self.json_news["batching"][key])
|
imio/smartweb/core/utils.py
CHANGED
@@ -228,3 +228,21 @@ def get_iadeliberation_json(url):
|
|
228
228
|
json = get_json(url, auth=f"Basic {b64Val.decode('utf-8')}", timeout=20)
|
229
229
|
|
230
230
|
return json
|
231
|
+
|
232
|
+
|
233
|
+
def remove_cache_key(json_data: dict) -> dict:
|
234
|
+
pattern = re.compile(r"&cache_key=[a-f0-9]{32}")
|
235
|
+
if json_data is None:
|
236
|
+
return json_data
|
237
|
+
if "@id" in json_data and isinstance(json_data["@id"], str):
|
238
|
+
json_data["@id"] = pattern.sub("", json_data["@id"])
|
239
|
+
|
240
|
+
# Nested keys inside 'batching'
|
241
|
+
if "batching" in json_data and isinstance(json_data["batching"], dict):
|
242
|
+
for key in ["@id", "first", "last", "next"]:
|
243
|
+
if key in json_data["batching"] and isinstance(
|
244
|
+
json_data["batching"][key], str
|
245
|
+
):
|
246
|
+
json_data["batching"][key] = pattern.sub("", json_data["batching"][key])
|
247
|
+
|
248
|
+
return json_data
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: imio.smartweb.core
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.86
|
4
4
|
Summary: Core product for iMio websites
|
5
5
|
Home-page: https://github.com/imio/imio.smartweb.core
|
6
6
|
Author: Christophe Boulanger
|
@@ -203,6 +203,16 @@ Changelog
|
|
203
203
|
=========
|
204
204
|
|
205
205
|
|
206
|
+
1.2.86 (2025-02-10)
|
207
|
+
-------------------
|
208
|
+
|
209
|
+
- WEB-4153 : Add a refresh_modification_date view to refresh the modification date of SectionEvents and SectionNews
|
210
|
+
[remdub]
|
211
|
+
|
212
|
+
- WEB-4153 : Add a cache key on SectionEvents and SectionNews requests to refresh the cache when the section is modified
|
213
|
+
[remdub]
|
214
|
+
|
215
|
+
|
206
216
|
1.2.85 (2025-02-10)
|
207
217
|
-------------------
|
208
218
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
imio.smartweb.core-1.2.
|
1
|
+
imio.smartweb.core-1.2.86-py3.12-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
|
2
2
|
imio/smartweb/core/__init__.py,sha256=iwhKnzeBJLKxpRVjvzwiRE63_zNpIBfaKLITauVph-0,24
|
3
3
|
imio/smartweb/core/config.py,sha256=BUgfvh4hCaw0onCYAG4gQI1O4hZ-GzXWEltdHi4YLIs,337
|
4
4
|
imio/smartweb/core/configure.zcml,sha256=PeC4rF--rF6MfVQ0NzggQrZWIl35oPtJdEhvQwGxhhI,1459
|
@@ -12,7 +12,7 @@ imio/smartweb/core/subscribers.py,sha256=zOmwTw0XvE6_bdoZI7qQln_W__7MxXCnKh6QwNK
|
|
12
12
|
imio/smartweb/core/subscribers.zcml,sha256=BnrxZp4AfsRYreYHsJJxKgPQZJ-wpNM2XnDTuDUbBkA,1616
|
13
13
|
imio/smartweb/core/testing.py,sha256=t0Y3t3FXX2RjgklcRzHT37AjKbMKL3ZjjT3d2UhQm7A,3636
|
14
14
|
imio/smartweb/core/testing.zcml,sha256=VyKjWW2QHYuUYKkGUvtsdFI_Pa7Wcp1yBBDla112eMc,172
|
15
|
-
imio/smartweb/core/utils.py,sha256=
|
15
|
+
imio/smartweb/core/utils.py,sha256=ToipQdzA1WnX8SLKIwaWhH7JraOBU89Q7ez2AJfAng8,8364
|
16
16
|
imio/smartweb/core/vocabularies.py,sha256=ZzdnK7m0dPogoKSrtdTjsxCQjaSqgVDAL9YPWMOHync,22905
|
17
17
|
imio/smartweb/core/vocabularies.zcml,sha256=KSH7JWlAJtKawLvfmsztZzE_AK1JR6B5udY6tleY2cQ,5904
|
18
18
|
imio/smartweb/core/behaviors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -238,10 +238,10 @@ imio/smartweb/core/contents/rest/search/configure.zcml,sha256=BTFcBQ28NINyEfoVgY
|
|
238
238
|
imio/smartweb/core/contents/rest/search/endpoint.py,sha256=i5LMM0R1Xvpy76JHO6pI98G41Xep15fPR9uv9rqropo,9797
|
239
239
|
imio/smartweb/core/contents/sections/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
240
240
|
imio/smartweb/core/contents/sections/base.py,sha256=2e3lIG_RGGFAshBEkTNG97OReAnn9GLQk_O_Eqh7SRY,2486
|
241
|
-
imio/smartweb/core/contents/sections/configure.zcml,sha256=
|
242
|
-
imio/smartweb/core/contents/sections/macros.pt,sha256=
|
241
|
+
imio/smartweb/core/contents/sections/configure.zcml,sha256=ApBAc2UyCmttliYs4BAC_ovaZXW4vz78LBPUaSGkpEk,3379
|
242
|
+
imio/smartweb/core/contents/sections/macros.pt,sha256=zlIgvxE5t0d6DKVrRzPHh058nmo6AmxiUUbGtEmL2KM,5923
|
243
243
|
imio/smartweb/core/contents/sections/subscriber.py,sha256=WM7nEZVPOkmyT1GfkWGDWwLhuhUYaTnlBr6BJVqUJMk,642
|
244
|
-
imio/smartweb/core/contents/sections/views.py,sha256=
|
244
|
+
imio/smartweb/core/contents/sections/views.py,sha256=0KA81s4rDfxTbT-CrxOv01uZ0dv2BDYeejjAvh7BIL8,6378
|
245
245
|
imio/smartweb/core/contents/sections/collection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
246
246
|
imio/smartweb/core/contents/sections/collection/configure.zcml,sha256=Ak4UbKFjogWZad6-5_y6oSx8tWXt3nN7bEdKXG7pQCI,920
|
247
247
|
imio/smartweb/core/contents/sections/collection/content.py,sha256=DMmU9rIaRlbRjIaot5RHXu59vJmAbun0FCmyahWhBCM,2379
|
@@ -260,7 +260,7 @@ imio/smartweb/core/contents/sections/events/__init__.py,sha256=47DEQpj8HBSa-_TIm
|
|
260
260
|
imio/smartweb/core/contents/sections/events/configure.zcml,sha256=FCDIf6w-2qCPqq0QUodw8-xyAopq7l6O8zoU_uMHNwg,1117
|
261
261
|
imio/smartweb/core/contents/sections/events/content.py,sha256=aolTpBgOCKu4EHLQUFjOkFN7YpJId0Wpj_iH5AZ9Vvk,3246
|
262
262
|
imio/smartweb/core/contents/sections/events/macros.pt,sha256=llSq-xstFiOXctseKDwvhVCM7A1_Z1Jq-_cUgNiBe10,1522
|
263
|
-
imio/smartweb/core/contents/sections/events/view.py,sha256=
|
263
|
+
imio/smartweb/core/contents/sections/events/view.py,sha256=Tl92dalLryRuilVfu0MRAQ51jkfHuQTpCsPT-u3q4fE,4774
|
264
264
|
imio/smartweb/core/contents/sections/external_content/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
265
265
|
imio/smartweb/core/contents/sections/external_content/configure.zcml,sha256=6ZvD4hJiXMZM2-mz9D7ipZcphS5HKJFREG9XUzF_6ms,1651
|
266
266
|
imio/smartweb/core/contents/sections/external_content/content.py,sha256=apHtfPwxkHkLQJVFVXs4F8O0gE09uI49AFQ8xRFrXgo,1096
|
@@ -295,7 +295,7 @@ imio/smartweb/core/contents/sections/map/views.py,sha256=3Z5oFis2NIByJCHh8bjAlLu
|
|
295
295
|
imio/smartweb/core/contents/sections/news/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
296
296
|
imio/smartweb/core/contents/sections/news/configure.zcml,sha256=8MOIEeI7Zr_wbNVgiMa_21Ohgv_bkpEi_7gJu6NK380,880
|
297
297
|
imio/smartweb/core/contents/sections/news/content.py,sha256=A79d6gfxiqrrL87VPqFz13NYAfTjHbSFNZlpi1kixzE,3261
|
298
|
-
imio/smartweb/core/contents/sections/news/view.py,sha256=
|
298
|
+
imio/smartweb/core/contents/sections/news/view.py,sha256=RZOVu160AINgtdNTs2eA4NahN4qRASfWVka_2hEu9qs,4401
|
299
299
|
imio/smartweb/core/contents/sections/postit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
300
300
|
imio/smartweb/core/contents/sections/postit/configure.zcml,sha256=Q0Szs1pmrNP2OiRROpeSQPKLV3tCpyjqZa9vwNFTK9Q,504
|
301
301
|
imio/smartweb/core/contents/sections/postit/content.py,sha256=--bqQPsjpKuqMzOb21eOERjp2a2QehGTAsBvZ3FnQMA,2239
|
@@ -438,7 +438,7 @@ imio/smartweb/core/tests/test_social.py,sha256=GVHkF4c8Ygnm09J1aGxhklbtd6b-1Fy8M
|
|
438
438
|
imio/smartweb/core/tests/test_subsite.py,sha256=wiD8Ke4_-ArstSYNLCs8ArqOuDx2xxUR6Wac3GXfnbE,9016
|
439
439
|
imio/smartweb/core/tests/test_text.py,sha256=DtZNNGJ-MDYbJ-YQj2C0q2Hr7t4-sUbV6SWkE7tihBY,4652
|
440
440
|
imio/smartweb/core/tests/test_toolbar.py,sha256=dxwOGNOg2wPkAnPU3hqGCI6VL2D2nPOIOtbMorvjfps,3823
|
441
|
-
imio/smartweb/core/tests/test_utils.py,sha256=
|
441
|
+
imio/smartweb/core/tests/test_utils.py,sha256=W_gR8ZOecscA6f86qrcOeQVGCzdyqhlzP6TgQI5ah2g,5045
|
442
442
|
imio/smartweb/core/tests/test_vocabularies.py,sha256=1oF4rFc9kd1baUMHBor5wX9_tR7fcziQ6rvcENjyNDU,16956
|
443
443
|
imio/smartweb/core/tests/test_vocabulary.py,sha256=9S3BtVIJbN1o0q2qMcX8k0CdUwixmc3DBs_s5qFrJwA,1648
|
444
444
|
imio/smartweb/core/tests/utils.py,sha256=hsDrWOxL0oNNyx92Hke9Kj9ByKzc2kZ19q9QPVsNud4,2688
|
@@ -462,6 +462,7 @@ imio/smartweb/core/tests/resources/json_iadeliberations_publication.json,sha256=
|
|
462
462
|
imio/smartweb/core/tests/resources/json_iadeliberations_publications.json,sha256=JsY4rynmLwpnmOEvvqhyoSQ0USUvNv3wGRYOGEKRThY,17115
|
463
463
|
imio/smartweb/core/tests/resources/json_news_entities_raw_mock.json,sha256=InbDt8kUmVBsfCTyfn5M6qqC1j8z5RB8Edg7hIWRv0g,726
|
464
464
|
imio/smartweb/core/tests/resources/json_news_newsfolder_raw_mock.json,sha256=JpryCi1tpJPAoqnF9c2ZPtcQc4R_ottDRiyU-z2x3FQ,783
|
465
|
+
imio/smartweb/core/tests/resources/json_news_raw_mock.json,sha256=P5KPoC_uJB3HaYY4t4J07uPjh58b-pxZD4ZrlKR1Gr4,15865
|
465
466
|
imio/smartweb/core/tests/resources/json_no_contact_raw_mock.json,sha256=tfcIZuQi1Lz8HV8EV93Qp1pUr9KbKATxu4MHnpiZSrc,127
|
466
467
|
imio/smartweb/core/tests/resources/json_no_newsfolder_raw_mock.json,sha256=qC4sfb5JCGTtZpM6a0t0_k1IADu_oyOazK7fow1gMCU,168
|
467
468
|
imio/smartweb/core/tests/resources/json_procedures_raw_mock.json,sha256=eMrKdEMFtSzpRmAF-PT-YMEXAoi3H0GozMli6znQGuU,3217
|
@@ -757,10 +758,10 @@ imio/smartweb/core/webcomponents/src/utils/Map.jsx,sha256=cYuZykMIaLjr4KiLvmS4aY
|
|
757
758
|
imio/smartweb/core/webcomponents/src/utils/Map.scss,sha256=xXWz0O-JBwSZrzz2XeQdN4nZEOjppU2sVFtlLQOitQ8,77
|
758
759
|
imio/smartweb/core/webcomponents/src/utils/translation.js,sha256=5YDHwdaRNWFWOgyNd7YejoAdcDvnvAENo3Xn0GDT8P8,8941
|
759
760
|
imio/smartweb/core/webcomponents/src/utils/url.js,sha256=iyl_1QXfPBgUn0LEbZYT_zMEEjmj5DMiEz44Z6AKLcg,244
|
760
|
-
imio.smartweb.core-1.2.
|
761
|
-
imio.smartweb.core-1.2.
|
762
|
-
imio.smartweb.core-1.2.
|
763
|
-
imio.smartweb.core-1.2.
|
764
|
-
imio.smartweb.core-1.2.
|
765
|
-
imio.smartweb.core-1.2.
|
766
|
-
imio.smartweb.core-1.2.
|
761
|
+
imio.smartweb.core-1.2.86.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
762
|
+
imio.smartweb.core-1.2.86.dist-info/LICENSE.rst,sha256=RzkMFz6AX3-cHd531zd2YQcXai8RIbjFWTs6m66Y5u4,653
|
763
|
+
imio.smartweb.core-1.2.86.dist-info/METADATA,sha256=o-etgfTICb5MaroIhxy03nNga9k3s5DUSTeMkCYdYZc,60571
|
764
|
+
imio.smartweb.core-1.2.86.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
765
|
+
imio.smartweb.core-1.2.86.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
|
766
|
+
imio.smartweb.core-1.2.86.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
|
767
|
+
imio.smartweb.core-1.2.86.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{imio.smartweb.core-1.2.85.dist-info → imio.smartweb.core-1.2.86.dist-info}/namespace_packages.txt
RENAMED
File without changes
|
File without changes
|