imio.smartweb.core 1.2.80__py3-none-any.whl → 1.2.84__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.
@@ -63,8 +63,7 @@
63
63
  <span tal:replace="python:contact.vat_number"></span>
64
64
  <ul class="contact_informations_genral"
65
65
  tal:define="phones python:contact.phones;
66
- mails python:contact.mails;
67
- urls python:contact.urls">
66
+ mails python:contact.mails">
68
67
  <li class="phones"
69
68
  tal:repeat="phone phones"
70
69
  tal:attributes="class python:phone.get('type') or ''">
@@ -81,7 +80,8 @@
81
80
  </li>
82
81
  </ul>
83
82
  <ul class="contact_informations_social"
84
- tal:define="urls python:contact.urls">
83
+ tal:define="urls python:contact.get_urls"
84
+ tal:condition="urls">
85
85
  <li class="urls"
86
86
  tal:repeat="url urls"
87
87
  tal:attributes="class python:url.get('type') or ''">
@@ -133,3 +133,23 @@ class ContactProperties(ContactSchedule):
133
133
  if not (street or entity or country):
134
134
  return None
135
135
  return {"street": street, "entity": entity, "country": country}
136
+
137
+ @property
138
+ def get_urls(self):
139
+ if isinstance(self.urls, list):
140
+ result = (
141
+ None
142
+ if all(
143
+ item["type"] is None and item["url"] is None for item in self.urls
144
+ )
145
+ else [
146
+ item
147
+ for item in self.urls
148
+ if not (item["type"] is None and item["url"] is None)
149
+ ]
150
+ )
151
+ elif self.urls is None:
152
+ result = None
153
+ else:
154
+ result = self.urls
155
+ return result
@@ -48,6 +48,7 @@ class BaseRequestForwarder(Service):
48
48
  else:
49
49
  token = get_wca_token(self.client_id, self.client_secret)
50
50
  headers = {"Accept": "application/json", "Authorization": token}
51
+ self.request.form.pop("wcatoken", None)
51
52
  if is_log_active():
52
53
  logger.info("======== Forwarding request to AUTHENTIC SOURCE =========")
53
54
  logger.info(f"url to forward : {url} ({method})")
@@ -59,21 +59,21 @@ class TestRedirectToMainReactView(ImioSmartwebTestCase):
59
59
  transaction.commit()
60
60
  rest_view_url = v.absolute_url()
61
61
  browser.open(f"{self.portal_url}/@@{k}_view")
62
- self.assertEquals(browser.url, rest_view_url)
62
+ self.assertEqual(browser.url, rest_view_url)
63
63
 
64
64
  v = api.content.move(v, folder)
65
65
  transaction.commit()
66
66
  rest_view_url = v.absolute_url()
67
67
  browser.open(f"{self.portal_url}/@@{k}_view")
68
- self.assertEquals(browser.url, rest_view_url)
68
+ self.assertEqual(browser.url, rest_view_url)
69
69
 
70
70
  obj = api_lng.translate(v, target_language="de")
71
71
  api.content.transition(obj, "publish")
72
72
  transaction.commit()
73
73
  browser.open(f"{self.portal_url}/@@{k}_view?language=de")
74
- self.assertEquals(browser.url, obj.absolute_url())
74
+ self.assertEqual(browser.url, obj.absolute_url())
75
75
 
76
76
  api.content.delete(v)
77
77
  transaction.commit()
78
78
  browser.open(f"{self.portal_url}/@@{k}_view")
79
- self.assertEquals(browser.url, self.portal_url)
79
+ self.assertEqual(browser.url, self.portal_url)
@@ -601,3 +601,61 @@ class TestSectionContact(ImioSmartwebTestCase):
601
601
 
602
602
  # TODO we should test with various contact sections containing
603
603
  # contacts
604
+
605
+ @requests_mock.Mocker()
606
+ def test_contact_urls(self, m):
607
+ contact = api.content.create(
608
+ container=self.page,
609
+ type="imio.smartweb.SectionContact",
610
+ title="My contact",
611
+ )
612
+ contact.visible_blocks = ["contact_informations"]
613
+ authentic_contact_uid = "2dc381f0fb584381b8e4a19c84f53b35"
614
+ contact.related_contacts = [authentic_contact_uid]
615
+ contact_search_url = (
616
+ "http://localhost:8080/Plone/@search?UID={}&fullobjects=1".format(
617
+ authentic_contact_uid
618
+ )
619
+ )
620
+ m.get(contact_search_url, text=json.dumps(self.json_contact))
621
+ contact_view = queryMultiAdapter((contact, self.request), name="view")
622
+ view = queryMultiAdapter((self.page, self.request), name="full_view")
623
+ self.assertNotIn('Error in section : "My contact"', view())
624
+ self.assertNotIn("contact_informations_social", view())
625
+
626
+ self.json_contact.get("items")[0]["urls"] = None
627
+ sleep(1)
628
+ m.get(contact_search_url, text=json.dumps(self.json_contact))
629
+ clear_cache(self.request)
630
+ contact_view = queryMultiAdapter((contact, self.request), name="view")
631
+ view = queryMultiAdapter((self.page, self.request), name="full_view")
632
+ self.assertNotIn('Error in section : "My contact"', view())
633
+ self.assertNotIn("contact_informations_social", view())
634
+
635
+ urls = [
636
+ {"type": None, "url": None},
637
+ {"type": None, "url": None},
638
+ {"type": None, "url": None},
639
+ ]
640
+ self.json_contact.get("items")[0]["urls"] = urls
641
+ sleep(1)
642
+ m.get(contact_search_url, text=json.dumps(self.json_contact))
643
+ clear_cache(self.request)
644
+ contact_view = queryMultiAdapter((contact, self.request), name="view")
645
+ view = queryMultiAdapter((self.page, self.request), name="full_view")
646
+ self.assertNotIn('Error in section : "My contact"', view())
647
+ self.assertNotIn("contact_informations_social", view())
648
+
649
+ urls = [
650
+ {"type": None, "url": None},
651
+ {"type": "facebook", "url": "Yolo"},
652
+ {"type": None, "url": None},
653
+ ]
654
+ self.json_contact.get("items")[0]["urls"] = urls
655
+ sleep(1)
656
+ m.get(contact_search_url, text=json.dumps(self.json_contact))
657
+ clear_cache(self.request)
658
+ contact_view = queryMultiAdapter((contact, self.request), name="view")
659
+ view = queryMultiAdapter((self.page, self.request), name="full_view")
660
+ self.assertNotIn('Error in section : "My contact"', view())
661
+ self.assertIn("contact_informations_social", view())
@@ -59,7 +59,8 @@ def concat_voca_title(title1, title2):
59
59
 
60
60
 
61
61
  def get_json(url, auth=None, timeout=5):
62
- headers = {"Accept": "application/json"}
62
+ language = api.portal.get_current_language()
63
+ headers = {"Accept": "application/json", "Cookie": f"I18N_LANGUAGE={language}"}
63
64
  if auth is not None:
64
65
  headers["Authorization"] = auth
65
66
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imio.smartweb.core
3
- Version: 1.2.80
3
+ Version: 1.2.84
4
4
  Summary: Core product for iMio websites
5
5
  Home-page: https://github.com/imio/imio.smartweb.core
6
6
  Author: Christophe Boulanger
@@ -17,12 +17,12 @@ Classifier: Framework :: Plone :: Addon
17
17
  Classifier: Framework :: Plone :: 6.0
18
18
  Classifier: Programming Language :: Python
19
19
  Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3.8
21
- Classifier: Programming Language :: Python :: 3.9
22
20
  Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
23
  Classifier: Operating System :: OS Independent
24
24
  Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
25
- Requires-Python: >=3.8
25
+ Requires-Python: >=3.10
26
26
  License-File: LICENSE.GPL
27
27
  License-File: LICENSE.rst
28
28
  Requires-Dist: setuptools
@@ -191,6 +191,37 @@ Changelog
191
191
  =========
192
192
 
193
193
 
194
+ 1.2.84 (2025-01-29)
195
+ -------------------
196
+
197
+ - Update Python classifiers to be compatible with Python 3.12
198
+ [remdub]
199
+
200
+
201
+ 1.2.83 (2025-01-29)
202
+ -------------------
203
+
204
+ - Migrate to Plone 6.0.14
205
+ [boulch]
206
+
207
+ - WEB-4206 : Remove wcatoken from query parameters when forwarding requests
208
+ [remdub]
209
+
210
+
211
+ 1.2.82 (2025-01-23)
212
+ -------------------
213
+
214
+ - WEB-4153 : Add language cookie to python requests to avoid cache problems
215
+ [remdub]
216
+
217
+
218
+ 1.2.81 (2025-01-15)
219
+ -------------------
220
+
221
+ - SUP-41924 : Fix a bug when there is some "void" urls getting in section Contact (and display "contact_informations")
222
+ [boulch]
223
+
224
+
194
225
  1.2.80 (2025-01-15)
195
226
  -------------------
196
227
 
@@ -1,4 +1,4 @@
1
- imio.smartweb.core-1.2.80-py3.8-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
1
+ imio.smartweb.core-1.2.84-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=krc0msUa9cHIALgT1RpqMXAslusg3FswRy4aY5o6oIo,7597
15
+ imio/smartweb/core/utils.py,sha256=dQzbLYiJh55dtQ0qekQNr2tPCiXVABiMPjTpcf2zj3U,7685
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
@@ -252,8 +252,8 @@ imio/smartweb/core/contents/sections/contact/__init__.py,sha256=47DEQpj8HBSa-_TI
252
252
  imio/smartweb/core/contents/sections/contact/configure.zcml,sha256=WjyGXO7alNf4yDW5dZCS_xQ_AYbQVQuRVRIeoyLIBzY,1591
253
253
  imio/smartweb/core/contents/sections/contact/content.py,sha256=MdhY6QPMdCseThddjwZ0e7xzkx1-p21MBuwqEic1f90,2690
254
254
  imio/smartweb/core/contents/sections/contact/forms.py,sha256=VlN_jse8tYxE9RCro2RgHlZRDDIyZA8Bjr-dNePZYwU,1387
255
- imio/smartweb/core/contents/sections/contact/macros.pt,sha256=bCuvXDaNBT84AHXHYUkazJ35FJ2YVGl61Ry7rXuLHgA,10870
256
- imio/smartweb/core/contents/sections/contact/utils.py,sha256=XPZW3b6kqiUQ7YxHP6r5mqYlXGsi7n0prepeTy-8EY8,5205
255
+ imio/smartweb/core/contents/sections/contact/macros.pt,sha256=wU-wXeHzq6gvm-q2RmnjE53H1AMkVYhq2YyYZU1speM,10857
256
+ imio/smartweb/core/contents/sections/contact/utils.py,sha256=4OlmRHwvR_lUiR1DAuFbSaRhqBboZHdrPVRJz1wZN9s,5778
257
257
  imio/smartweb/core/contents/sections/contact/view.pt,sha256=CyNoSxzf9kNQdjN2iCp77zpFeXfC1KGgQlx_UeTSQ6M,1170
258
258
  imio/smartweb/core/contents/sections/contact/view.py,sha256=7zTN6JPUaeomzfiaE5eUyvFIqfyPNg2UJDOVpzt6vJ8,1962
259
259
  imio/smartweb/core/contents/sections/events/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -394,7 +394,7 @@ imio/smartweb/core/profiles/testing/types/imio.smartweb.NewsView.xml,sha256=6Rpf
394
394
  imio/smartweb/core/profiles/uninstall/browserlayer.xml,sha256=K8KnZFW9E6Hwi61Z6XZlXOjUpAKzJR6HjmjoOjFEWrk,128
395
395
  imio/smartweb/core/profiles/validation/contentrules.xml,sha256=QyX3E0ihDOMhaJPrKPRqRiCUvPoghs3fwYOj_eNtbqw,4626
396
396
  imio/smartweb/core/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
397
- imio/smartweb/core/rest/authentic_sources.py,sha256=ZH7kHNAow_t6pnEObZ_x2jfnHi0pZOrr9OO6MQHiG_8,4957
397
+ imio/smartweb/core/rest/authentic_sources.py,sha256=GesGFal1TsEN6LRwI_idcpoxJ6bBzYYxV4Lfk2plqtQ,5005
398
398
  imio/smartweb/core/rest/configure.zcml,sha256=3tEU99M_deyoRN0YeIVQmPk7NL88gjYtXZOT8QmSbN4,2891
399
399
  imio/smartweb/core/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
400
400
  imio/smartweb/core/tests/test_banner.py,sha256=83Q86ezLMJVwCLxoJddmlE9GKR3h6Qyb-rbqVSFc8a0,7838
@@ -421,11 +421,11 @@ imio/smartweb/core/tests/test_page.py,sha256=1dD9M_6nwS6M2OuyWmT5cPq5qnxnog3tcqF
421
421
  imio/smartweb/core/tests/test_plausibleview.py,sha256=G1ryfnz3TuQBG8VFO5KzEylT5DFABW58PQuuvPq_ccY,3229
422
422
  imio/smartweb/core/tests/test_portal_page.py,sha256=hIqg4eb91o8BsSj7eSKdvoxehzOXt8bzpg1o5ej__zg,7215
423
423
  imio/smartweb/core/tests/test_procedure.py,sha256=0w8phOwYfpp9vb3KDsnwjX8AhQXWdodA06W4koderQo,6474
424
- imio/smartweb/core/tests/test_redirect_to_main_react_view.py,sha256=k4gU6xBIA5m8Vrb27rt8nWCs8ix2Lf9j49WnIXl4eO0,2990
424
+ imio/smartweb/core/tests/test_redirect_to_main_react_view.py,sha256=3Pa_4BAmyz67onEaHochsubdEqszAMf2j0lkscEY50c,2986
425
425
  imio/smartweb/core/tests/test_rest.py,sha256=t7dp7YWUCKR75tsU3vVOzAy9HivGBWuMJoeMpuKOXbM,27374
426
426
  imio/smartweb/core/tests/test_robot.py,sha256=NQ7AkN4tEva3bgGjMxmyqY0zIo4pJPnPOwnD9hmrTVI,926
427
427
  imio/smartweb/core/tests/test_search.py,sha256=VryeRI4_5CvnStKOoNoG95M2WTy7Lyy_AhHIDG40M14,2182
428
- imio/smartweb/core/tests/test_section_contact.py,sha256=TePnLCLu8pqA4d1SYRK8dGi7m7BbooiTTkQUC4KztAs,24693
428
+ imio/smartweb/core/tests/test_section_contact.py,sha256=BiJPxb67d7zURE5Dtk-9xOUbuJitcQ7YnlzDS1sT-cE,27344
429
429
  imio/smartweb/core/tests/test_section_events.py,sha256=7eP-HmXp0D3gvOrjVpzVPmV9nF_PKERnmOGz1G3Z0l0,8641
430
430
  imio/smartweb/core/tests/test_section_external_content.py,sha256=JI_zm3160ryO8a6NjtcmcboUJdJDa7lEX6ommbxlGao,7617
431
431
  imio/smartweb/core/tests/test_section_news.py,sha256=6S7-r6ZnpeN_JdLYLZMWbHKRzeuf5ynPWnox2DDFPZk,9126
@@ -756,10 +756,10 @@ imio/smartweb/core/webcomponents/src/utils/Map.jsx,sha256=cYuZykMIaLjr4KiLvmS4aY
756
756
  imio/smartweb/core/webcomponents/src/utils/Map.scss,sha256=xXWz0O-JBwSZrzz2XeQdN4nZEOjppU2sVFtlLQOitQ8,77
757
757
  imio/smartweb/core/webcomponents/src/utils/translation.js,sha256=5YDHwdaRNWFWOgyNd7YejoAdcDvnvAENo3Xn0GDT8P8,8941
758
758
  imio/smartweb/core/webcomponents/src/utils/url.js,sha256=iyl_1QXfPBgUn0LEbZYT_zMEEjmj5DMiEz44Z6AKLcg,244
759
- imio.smartweb.core-1.2.80.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
760
- imio.smartweb.core-1.2.80.dist-info/LICENSE.rst,sha256=RzkMFz6AX3-cHd531zd2YQcXai8RIbjFWTs6m66Y5u4,653
761
- imio.smartweb.core-1.2.80.dist-info/METADATA,sha256=bVc7fUNc0miHO2YTqzs7gCnP8RwTZeiGiAo0PeiTvfQ,58951
762
- imio.smartweb.core-1.2.80.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
763
- imio.smartweb.core-1.2.80.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
764
- imio.smartweb.core-1.2.80.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
765
- imio.smartweb.core-1.2.80.dist-info/RECORD,,
759
+ imio.smartweb.core-1.2.84.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
760
+ imio.smartweb.core-1.2.84.dist-info/LICENSE.rst,sha256=RzkMFz6AX3-cHd531zd2YQcXai8RIbjFWTs6m66Y5u4,653
761
+ imio.smartweb.core-1.2.84.dist-info/METADATA,sha256=alCP5U7_-Zpi5R2qfvYdJhnKoWIFvNdh6qKFJlN7gbI,59541
762
+ imio.smartweb.core-1.2.84.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
763
+ imio.smartweb.core-1.2.84.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
764
+ imio.smartweb.core-1.2.84.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
765
+ imio.smartweb.core-1.2.84.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5