imio.smartweb.core 1.2.80__py3-none-any.whl → 1.2.81__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
@@ -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())
@@ -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.81
4
4
  Summary: Core product for iMio websites
5
5
  Home-page: https://github.com/imio/imio.smartweb.core
6
6
  Author: Christophe Boulanger
@@ -28,7 +28,7 @@ License-File: LICENSE.rst
28
28
  Requires-Dist: setuptools
29
29
  Requires-Dist: z3c.jbot
30
30
  Requires-Dist: z3c.unconfigure
31
- Requires-Dist: plone.api>=1.8.4
31
+ Requires-Dist: plone.api >=1.8.4
32
32
  Requires-Dist: plone.gallery
33
33
  Requires-Dist: plone.restapi
34
34
  Requires-Dist: plone.app.dexterity
@@ -49,14 +49,14 @@ Requires-Dist: more-itertools
49
49
  Requires-Dist: imio.smartweb.common
50
50
  Requires-Dist: imio.smartweb.locales
51
51
  Provides-Extra: test
52
- Requires-Dist: plone.app.testing; extra == "test"
53
- Requires-Dist: plone.testing>=5.0.0; extra == "test"
54
- Requires-Dist: plone.app.contenttypes; extra == "test"
55
- Requires-Dist: plone.app.robotframework[debug]; extra == "test"
56
- Requires-Dist: plone.restapi[test]; extra == "test"
57
- Requires-Dist: requests-mock; extra == "test"
58
- Requires-Dist: beautifulsoup4; extra == "test"
59
- Requires-Dist: freezegun; extra == "test"
52
+ Requires-Dist: plone.app.testing ; extra == 'test'
53
+ Requires-Dist: plone.testing >=5.0.0 ; extra == 'test'
54
+ Requires-Dist: plone.app.contenttypes ; extra == 'test'
55
+ Requires-Dist: plone.app.robotframework[debug] ; extra == 'test'
56
+ Requires-Dist: plone.restapi[test] ; extra == 'test'
57
+ Requires-Dist: requests-mock ; extra == 'test'
58
+ Requires-Dist: beautifulsoup4 ; extra == 'test'
59
+ Requires-Dist: freezegun ; extra == 'test'
60
60
 
61
61
  .. This README is meant for consumption by humans and pypi. Pypi can render rst files so please do not use Sphinx features.
62
62
  If you want to learn more about writing documentation, please check out: http://docs.plone.org/about/documentation_styleguide.html
@@ -191,6 +191,13 @@ Changelog
191
191
  =========
192
192
 
193
193
 
194
+ 1.2.81 (2025-01-15)
195
+ -------------------
196
+
197
+ - SUP-41924 : Fix a bug when there is some "void" urls getting in section Contact (and display "contact_informations")
198
+ [boulch]
199
+
200
+
194
201
  1.2.80 (2025-01-15)
195
202
  -------------------
196
203
 
@@ -1,4 +1,4 @@
1
- imio.smartweb.core-1.2.80-py3.8-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
1
+ imio.smartweb.core-1.2.81-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
@@ -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
@@ -425,7 +425,7 @@ imio/smartweb/core/tests/test_redirect_to_main_react_view.py,sha256=k4gU6xBIA5m8
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.81.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
760
+ imio.smartweb.core-1.2.81.dist-info/LICENSE.rst,sha256=RzkMFz6AX3-cHd531zd2YQcXai8RIbjFWTs6m66Y5u4,653
761
+ imio.smartweb.core-1.2.81.dist-info/METADATA,sha256=w375PAw3CwzcYY_CVYg_m7p_CD0RkSPSrpucZU_dySI,59134
762
+ imio.smartweb.core-1.2.81.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
763
+ imio.smartweb.core-1.2.81.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
764
+ imio.smartweb.core-1.2.81.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
765
+ imio.smartweb.core-1.2.81.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5