imio.smartweb.core 1.2.51__py3-none-any.whl → 1.2.53__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.
@@ -1,10 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
- from plone.app.content.browser.vocabulary import VocabularyView
2
+
3
+ from imio.smartweb.common.browser.vocabulary import TranslatedVocabularyView
3
4
  from plone.app.content.browser.vocabulary import VocabLookupException
4
5
  from plone.app.content.utils import json_dumps
5
6
 
6
7
 
7
- class SmartwebVocabularyView(VocabularyView):
8
+ class SmartwebVocabularyView(TranslatedVocabularyView):
8
9
 
9
10
  def __call__(self):
10
11
  form = self.request.form
@@ -1,9 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from imio.smartweb.common.widgets.select import TranslatedAjaxSelectWidget
3
4
  from imio.smartweb.core.contents.sections.base import ISection
4
5
  from imio.smartweb.core.contents.sections.base import Section
5
6
  from imio.smartweb.locales import SmartwebMessageFactory as _
6
- from plone.app.z3cform.widget import AjaxSelectFieldWidget
7
7
  from plone.autoform import directives
8
8
  from plone.supermodel import model
9
9
  from z3c.form.browser.checkbox import CheckBoxFieldWidget
@@ -16,7 +16,7 @@ class ISectionContact(ISection):
16
16
 
17
17
  directives.widget(
18
18
  "related_contacts",
19
- AjaxSelectFieldWidget,
19
+ TranslatedAjaxSelectWidget,
20
20
  vocabulary="imio.smartweb.vocabulary.RemoteContacts",
21
21
  pattern_options={"multiple": True},
22
22
  )
@@ -1,10 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from imio.smartweb.common.widgets.select import TranslatedAjaxSelectWidget
3
4
  from imio.smartweb.core.contents.sections.base import ISection
4
5
  from imio.smartweb.core.contents.sections.base import Section
5
6
  from imio.smartweb.locales import SmartwebMessageFactory as _
6
7
  from plone.app.z3cform.widget import RelatedItemsFieldWidget
7
- from plone.app.z3cform.widget import AjaxSelectFieldWidget
8
8
  from plone.app.z3cform.widget import SelectFieldWidget
9
9
  from plone.autoform import directives
10
10
  from plone.supermodel import model
@@ -13,8 +13,8 @@ from zope import schema
13
13
  from zope.globalrequest import getRequest
14
14
  from zope.i18n import translate
15
15
  from zope.interface import implementer
16
- from zope.schema.interfaces import IContextAwareDefaultFactory
17
16
  from zope.interface import provider
17
+ from zope.schema.interfaces import IContextAwareDefaultFactory
18
18
 
19
19
 
20
20
  @provider(IContextAwareDefaultFactory)
@@ -40,7 +40,7 @@ class ISectionEvents(ISection):
40
40
  )
41
41
  directives.widget(
42
42
  "specific_related_events",
43
- AjaxSelectFieldWidget,
43
+ TranslatedAjaxSelectWidget,
44
44
  source="imio.smartweb.vocabulary.EventsFromEntity",
45
45
  )
46
46
 
@@ -1,10 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from imio.smartweb.common.widgets.select import TranslatedAjaxSelectWidget
3
4
  from imio.smartweb.core.contents.sections.base import ISection
4
5
  from imio.smartweb.core.contents.sections.base import Section
5
6
  from imio.smartweb.locales import SmartwebMessageFactory as _
6
7
  from plone.app.z3cform.widget import RelatedItemsFieldWidget
7
- from plone.app.z3cform.widget import AjaxSelectFieldWidget
8
8
  from plone.app.z3cform.widget import SelectFieldWidget
9
9
  from plone.autoform import directives
10
10
  from plone.supermodel import model
@@ -40,7 +40,7 @@ class ISectionNews(ISection):
40
40
  )
41
41
  directives.widget(
42
42
  "specific_related_newsitems",
43
- AjaxSelectFieldWidget,
43
+ TranslatedAjaxSelectWidget,
44
44
  source="imio.smartweb.vocabulary.NewsItemsFromEntity",
45
45
  )
46
46
 
@@ -0,0 +1,43 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_INTEGRATION_TESTING
4
+ from imio.smartweb.core.testing import ImioSmartwebTestCase
5
+ from plone import api
6
+ from plone.app.testing import setRoles
7
+ from plone.app.testing import TEST_USER_ID
8
+ from unittest.mock import patch
9
+ from zope.component import queryMultiAdapter
10
+
11
+ import json
12
+
13
+
14
+ class TestVocabulary(ImioSmartwebTestCase):
15
+ layer = IMIO_SMARTWEB_CORE_INTEGRATION_TESTING
16
+
17
+ def setUp(self):
18
+ """Custom shared utility setup for tests"""
19
+ self.request = self.layer["request"]
20
+ self.portal = self.layer["portal"]
21
+ setRoles(self.portal, TEST_USER_ID, ["Manager"])
22
+ self.page = api.content.create(
23
+ container=self.portal,
24
+ type="imio.smartweb.Page",
25
+ title="My Page",
26
+ )
27
+
28
+ def test_getvocabulary(self):
29
+ self.request.form = {
30
+ "name": "imio.smartweb.vocabulary.Topics",
31
+ "field": "topics",
32
+ }
33
+ view = queryMultiAdapter((self.page, self.request), name="getVocabulary")
34
+ result = json.loads(view())
35
+ self.assertEqual(result["results"][0]["id"], "entertainment")
36
+ self.assertEqual(result["results"][0]["text"], "Entertainment")
37
+ with patch("plone.api.portal.get_current_language", return_value="fr"):
38
+ view = queryMultiAdapter((self.page, self.request), name="getVocabulary")
39
+ result = json.loads(view())
40
+ self.assertEqual(result["results"][0]["id"], "entertainment")
41
+ self.assertEqual(
42
+ result["results"][0]["text"], "Activités et divertissement"
43
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imio.smartweb.core
3
- Version: 1.2.51
3
+ Version: 1.2.53
4
4
  Summary: Core product for iMio websites
5
5
  Home-page: https://github.com/imio/imio.smartweb.core
6
6
  Author: Christophe Boulanger
@@ -189,6 +189,21 @@ Changelog
189
189
  =========
190
190
 
191
191
 
192
+ 1.2.53 (2024-06-06)
193
+ -------------------
194
+
195
+ - WEB-4113 : Use `TranslatedAjaxSelectWidget` to fix select2 values translation
196
+ [laulaz]
197
+
198
+
199
+ 1.2.52 (2024-06-06)
200
+ -------------------
201
+
202
+ - WEB-4113 : Inherit `getVocabulary` from `imio.smartweb.common` view to handle
203
+ vocabularies translations correctly
204
+ [laulaz]
205
+
206
+
192
207
  1.2.51 (2024-06-03)
193
208
  -------------------
194
209
 
@@ -1,4 +1,4 @@
1
- imio.smartweb.core-1.2.51-py3.8-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
1
+ imio.smartweb.core-1.2.53-py3.11-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
@@ -32,7 +32,7 @@ imio/smartweb/core/browser/layout.py,sha256=wvo_Q2dYg1Yd8wOdYSfPg29NPESy9ndAGl6z
32
32
  imio/smartweb/core/browser/redirect_to_main_react_view.py,sha256=vzJwAet0P2uoMhlOtNjMy02e4LQw9DsHb6mRgBXGOB8,1668
33
33
  imio/smartweb/core/browser/sitemap.py,sha256=voch7Bvchz3NTCm9zUC75sShCLD4KunLKyWA6OtaGmE,5962
34
34
  imio/smartweb/core/browser/utils.py,sha256=ccA2DVA994S3t92_fQeMSFIGfAblE9C1vw78ZFUAJiU,3218
35
- imio/smartweb/core/browser/vocabulary.py,sha256=CHQeWZwvjDeoPLZS6C89ucfGGGnxBbAYpVu31_n7TSA,1142
35
+ imio/smartweb/core/browser/vocabulary.py,sha256=VItGfYrv9NSHiUpEhnLkY4SpW8N2X91BX6A8UtsC8cA,1166
36
36
  imio/smartweb/core/browser/banner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  imio/smartweb/core/browser/banner/configure.zcml,sha256=Z2M7gkRDdmV4zRekUhyuJ-_jvbIbhgTj2Zq674iKvUE,389
38
38
  imio/smartweb/core/browser/banner/settings.py,sha256=jfD705_q8MAHUJbjjcfcPj1f98Rahiz_Mks2Ctx5kMA,947
@@ -232,7 +232,7 @@ imio/smartweb/core/contents/sections/common_templates/carousel.pt,sha256=vcRaxpk
232
232
  imio/smartweb/core/contents/sections/common_templates/table.pt,sha256=xr7HPyKP61RF75YnFUKPi_FudwVt_BJn3BzxXglQm3c,6769
233
233
  imio/smartweb/core/contents/sections/contact/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
234
234
  imio/smartweb/core/contents/sections/contact/configure.zcml,sha256=WjyGXO7alNf4yDW5dZCS_xQ_AYbQVQuRVRIeoyLIBzY,1591
235
- imio/smartweb/core/contents/sections/contact/content.py,sha256=SSeWBuqs1iDIhaGODI_gCsw4Q6ANBq6m7exZv1lPl_k,2669
235
+ imio/smartweb/core/contents/sections/contact/content.py,sha256=MdhY6QPMdCseThddjwZ0e7xzkx1-p21MBuwqEic1f90,2690
236
236
  imio/smartweb/core/contents/sections/contact/forms.py,sha256=VlN_jse8tYxE9RCro2RgHlZRDDIyZA8Bjr-dNePZYwU,1387
237
237
  imio/smartweb/core/contents/sections/contact/macros.pt,sha256=ynqVHvtvvcNyAIGj5K07SO9jyRN0R3KbFBBn4t1qMaE,9523
238
238
  imio/smartweb/core/contents/sections/contact/utils.py,sha256=OsrEgrf0DuCHa_RlEP4gwHxSzOGqBMDZMDViO19w-Lc,5129
@@ -240,7 +240,7 @@ imio/smartweb/core/contents/sections/contact/view.pt,sha256=CyNoSxzf9kNQdjN2iCp7
240
240
  imio/smartweb/core/contents/sections/contact/view.py,sha256=5l5FQLxz-UfFZrttqNsWetuCg-4yT-wIzukIK-QLF6s,1422
241
241
  imio/smartweb/core/contents/sections/events/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
242
242
  imio/smartweb/core/contents/sections/events/configure.zcml,sha256=FCDIf6w-2qCPqq0QUodw8-xyAopq7l6O8zoU_uMHNwg,1117
243
- imio/smartweb/core/contents/sections/events/content.py,sha256=i7OBUYmSrEQUBbnPK187l7cdygKGoiCgXN1WK7AYeHo,3177
243
+ imio/smartweb/core/contents/sections/events/content.py,sha256=lfu_o-jyDIxNAfmC0GTWubVl7tHVfCmGICiKD8vtZJg,3198
244
244
  imio/smartweb/core/contents/sections/events/macros.pt,sha256=llSq-xstFiOXctseKDwvhVCM7A1_Z1Jq-_cUgNiBe10,1522
245
245
  imio/smartweb/core/contents/sections/events/view.py,sha256=Ylp23caV6ba8y0jjoradXsRnueIABPD4cC7A2maR97c,4528
246
246
  imio/smartweb/core/contents/sections/external_content/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -276,7 +276,7 @@ imio/smartweb/core/contents/sections/map/view.pt,sha256=tEEL2ht3KYKJC87_SaT25Ij6
276
276
  imio/smartweb/core/contents/sections/map/views.py,sha256=3Z5oFis2NIByJCHh8bjAlLutc4Wp8j6rY6bkvShxEm8,614
277
277
  imio/smartweb/core/contents/sections/news/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
278
278
  imio/smartweb/core/contents/sections/news/configure.zcml,sha256=8MOIEeI7Zr_wbNVgiMa_21Ohgv_bkpEi_7gJu6NK380,880
279
- imio/smartweb/core/contents/sections/news/content.py,sha256=xqVlWUD4aX4CPLX72ilKaBW65XrE37dZqCtq4p2rZwQ,3192
279
+ imio/smartweb/core/contents/sections/news/content.py,sha256=3zI0rjAOLhK8HmBN4kRRP3kBRfdFrwCFQVbm4RnA9bs,3213
280
280
  imio/smartweb/core/contents/sections/news/view.py,sha256=e3gwMlyxevvqHJ1CxSMQ8W_q8KECpB8F5inwbofzhQg,4155
281
281
  imio/smartweb/core/contents/sections/postit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
282
282
  imio/smartweb/core/contents/sections/postit/configure.zcml,sha256=Q0Szs1pmrNP2OiRROpeSQPKLV3tCpyjqZa9vwNFTK9Q,504
@@ -419,6 +419,7 @@ imio/smartweb/core/tests/test_text.py,sha256=DtZNNGJ-MDYbJ-YQj2C0q2Hr7t4-sUbV6SW
419
419
  imio/smartweb/core/tests/test_toolbar.py,sha256=dxwOGNOg2wPkAnPU3hqGCI6VL2D2nPOIOtbMorvjfps,3823
420
420
  imio/smartweb/core/tests/test_utils.py,sha256=CkRkK3SbT4oQx_-Nq2Z0AhmhzR4kk2BkIZqSbIiPU04,4125
421
421
  imio/smartweb/core/tests/test_vocabularies.py,sha256=5DRfIlpOpXauXCgNN3UAUJJh246naykErGNBcYfYx0M,14368
422
+ imio/smartweb/core/tests/test_vocabulary.py,sha256=9S3BtVIJbN1o0q2qMcX8k0CdUwixmc3DBs_s5qFrJwA,1648
422
423
  imio/smartweb/core/tests/utils.py,sha256=hsDrWOxL0oNNyx92Hke9Kj9ByKzc2kZ19q9QPVsNud4,2688
423
424
  imio/smartweb/core/tests/resources/cirkwi_bad_widget_mock.html,sha256=13YeZ0mo8PoeHIHa64SLKuhNfGqBMT2uprmYDyQxE78,150
424
425
  imio/smartweb/core/tests/resources/cirkwi_good_widget_mock.html,sha256=vBgQwBKNGcGRrOHfXYZO_gmAGL1oKPDIUOnDfXEHCR4,333252
@@ -722,10 +723,10 @@ imio/smartweb/core/webcomponents/src/utils/Map.jsx,sha256=cYuZykMIaLjr4KiLvmS4aY
722
723
  imio/smartweb/core/webcomponents/src/utils/Map.scss,sha256=xXWz0O-JBwSZrzz2XeQdN4nZEOjppU2sVFtlLQOitQ8,77
723
724
  imio/smartweb/core/webcomponents/src/utils/translation.js,sha256=5YDHwdaRNWFWOgyNd7YejoAdcDvnvAENo3Xn0GDT8P8,8941
724
725
  imio/smartweb/core/webcomponents/src/utils/url.js,sha256=iyl_1QXfPBgUn0LEbZYT_zMEEjmj5DMiEz44Z6AKLcg,244
725
- imio.smartweb.core-1.2.51.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
726
- imio.smartweb.core-1.2.51.dist-info/LICENSE.rst,sha256=RzkMFz6AX3-cHd531zd2YQcXai8RIbjFWTs6m66Y5u4,653
727
- imio.smartweb.core-1.2.51.dist-info/METADATA,sha256=eSKrKbHkoP4XbSyx98ENxoDizrNrnJk9yjjJi2NzD4w,53609
728
- imio.smartweb.core-1.2.51.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
729
- imio.smartweb.core-1.2.51.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
730
- imio.smartweb.core-1.2.51.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
731
- imio.smartweb.core-1.2.51.dist-info/RECORD,,
726
+ imio.smartweb.core-1.2.53.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
727
+ imio.smartweb.core-1.2.53.dist-info/LICENSE.rst,sha256=RzkMFz6AX3-cHd531zd2YQcXai8RIbjFWTs6m66Y5u4,653
728
+ imio.smartweb.core-1.2.53.dist-info/METADATA,sha256=cNSp1IiYz5sLOMphox2md2nn5tzGzqNCr_ycL96rSUw,53915
729
+ imio.smartweb.core-1.2.53.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
730
+ imio.smartweb.core-1.2.53.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
731
+ imio.smartweb.core-1.2.53.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
732
+ imio.smartweb.core-1.2.53.dist-info/RECORD,,