imio.smartweb.core 1.2.76__py3-none-any.whl → 1.2.77__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.
@@ -4,6 +4,7 @@ from imio.smartweb.common.faceted.utils import configure_faceted
4
4
  from imio.smartweb.common.utils import is_log_active
5
5
  from imio.smartweb.common.utils import remove_cropping
6
6
  from imio.smartweb.core.behaviors.minisite import IImioSmartwebMinisite
7
+ from imio.smartweb.core.interfaces import IOdwbViewUtils
7
8
  from imio.smartweb.core.utils import get_iadeliberation_institution_from_registry
8
9
  from imio.smartweb.core.utils import get_iadeliberation_json
9
10
  from imio.smartweb.core.utils import safe_html
@@ -14,6 +15,8 @@ from plone.app.layout.navigation.interfaces import INavigationRoot
14
15
  from plone.namedfile.field import NamedBlobImage
15
16
  from zope.annotation.interfaces import IAnnotations
16
17
  from zope.component import getMultiAdapter
18
+ from zope.interface import alsoProvides
19
+ from zope.interface import noLongerProvides
17
20
  from zope.lifecycleevent import ObjectRemovedEvent
18
21
  from zope.lifecycleevent.interfaces import IAttributes
19
22
  from zope.globalrequest import getRequest
@@ -130,3 +133,24 @@ def added_publication(obj, event):
130
133
  obj.publication_attached_file = json_publication.get("file")
131
134
  except Exception:
132
135
  logger.error(f"Error while trying to get publication data from {url}")
136
+
137
+
138
+ def added_external_content(obj, event):
139
+ parent = obj.aq_parent
140
+ if not IOdwbViewUtils.providedBy(parent):
141
+ alsoProvides(parent, IOdwbViewUtils)
142
+ parent.reindexObject()
143
+
144
+
145
+ def removed_external_content(obj, event):
146
+ parent = obj.aq_parent
147
+ sections_external_content = parent.listFolderContents(
148
+ contentFilter={
149
+ "portal_type": [
150
+ "imio.smartweb.SectionExternalContent",
151
+ ]
152
+ }
153
+ )
154
+ if IOdwbViewUtils.providedBy(parent) and len(sections_external_content) == 0:
155
+ noLongerProvides(parent, IOdwbViewUtils)
156
+ parent.reindexObject()
@@ -25,4 +25,12 @@
25
25
  zope.lifecycleevent.interfaces.IObjectAddedEvent"
26
26
  handler=".subscribers.added_publication" />
27
27
 
28
+ <subscriber for="imio.smartweb.core.contents.ISectionExternalContent
29
+ zope.lifecycleevent.interfaces.IObjectAddedEvent"
30
+ handler=".subscribers.added_external_content" />
31
+
32
+ <subscriber for="imio.smartweb.core.contents.ISectionExternalContent
33
+ zope.lifecycleevent.interfaces.IObjectRemovedEvent"
34
+ handler=".subscribers.removed_external_content" />
35
+
28
36
  </configure>
@@ -1,11 +1,14 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ from imio.smartweb.core.interfaces import IOdwbViewUtils
3
4
  from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING
4
5
  from imio.smartweb.core.testing import ImioSmartwebTestCase
5
6
  from plone import api
6
7
  from plone.app.testing import setRoles
7
8
  from plone.app.testing import TEST_USER_ID
8
9
  from zope.component import queryMultiAdapter
10
+ from zope.interface import alsoProvides
11
+ from zope.interface import noLongerProvides
9
12
 
10
13
 
11
14
  class TestSectionExternalContent(ImioSmartwebTestCase):
@@ -21,6 +24,28 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
21
24
  id="page",
22
25
  )
23
26
 
27
+ def test_parent_marker_interface(self):
28
+ sec1 = api.content.create(
29
+ container=self.page, type="imio.smartweb.SectionExternalContent", id="sec1"
30
+ )
31
+ self.assertTrue(IOdwbViewUtils.providedBy(self.page))
32
+
33
+ sec2 = api.content.create(
34
+ container=self.page, type="imio.smartweb.SectionExternalContent", id="sec2"
35
+ )
36
+ api.content.delete(obj=sec1)
37
+ self.assertTrue(IOdwbViewUtils.providedBy(self.page))
38
+
39
+ api.content.delete(obj=sec2)
40
+ self.assertFalse(IOdwbViewUtils.providedBy(self.page))
41
+
42
+ api.content.create(
43
+ container=self.page,
44
+ type="imio.smartweb.SectionText",
45
+ id="not_external_content_section",
46
+ )
47
+ self.assertFalse(IOdwbViewUtils.providedBy(self.page))
48
+
24
49
  def test_unknow_service(self):
25
50
  sec = api.content.create(
26
51
  container=self.page, type="imio.smartweb.SectionExternalContent", id="sec"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imio.smartweb.core
3
- Version: 1.2.76
3
+ Version: 1.2.77
4
4
  Summary: Core product for iMio websites
5
5
  Home-page: https://github.com/imio/imio.smartweb.core
6
6
  Author: Christophe Boulanger
@@ -191,6 +191,14 @@ Changelog
191
191
  =========
192
192
 
193
193
 
194
+ 1.2.77 (2025-01-06)
195
+ -------------------
196
+
197
+ - WEB-4158 : ods_widget (css and js) are not loaded anymore on all pages
198
+ They are only loaded on pages that contains an external content section
199
+ [boulch]
200
+
201
+
194
202
  1.2.76 (2025-01-06)
195
203
  -------------------
196
204
 
@@ -1,4 +1,4 @@
1
- imio.smartweb.core-1.2.76-py3.12-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
1
+ imio.smartweb.core-1.2.77-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
@@ -8,8 +8,8 @@ imio/smartweb/core/interfaces.py,sha256=ioMwBC-HdOyz35HQGMZTksaJf8GLS2hbRz2wjvB_
8
8
  imio/smartweb/core/permissions.zcml,sha256=ZyBEARyO8NAq7tKFTb3G1FqEWERT1mQQ6vCVzji1ci8,1777
9
9
  imio/smartweb/core/profiles.zcml,sha256=H9crlNrI8zLxgmkpbkhkD3Ti5LRF8Zutk3AJXNBpvw0,2299
10
10
  imio/smartweb/core/setuphandlers.py,sha256=k1K8-ezP2gELwCNM5An2bBwQJjAKeS0rYtr2-q_InK8,932
11
- imio/smartweb/core/subscribers.py,sha256=mrZWdDyxtywCnts_SiJr7TeVnhzLsjWEe6AyM2r-Mos,5174
12
- imio/smartweb/core/subscribers.zcml,sha256=WWeOFM6nOZ5MBfaijdE_UfWqYcAYepAkvO-vxPvBE9w,1204
11
+ imio/smartweb/core/subscribers.py,sha256=zOmwTw0XvE6_bdoZI7qQln_W__7MxXCnKh6QwNK65x4,5937
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
15
  imio/smartweb/core/utils.py,sha256=krc0msUa9cHIALgT1RpqMXAslusg3FswRy4aY5o6oIo,7597
@@ -427,7 +427,7 @@ imio/smartweb/core/tests/test_robot.py,sha256=NQ7AkN4tEva3bgGjMxmyqY0zIo4pJPnPOw
427
427
  imio/smartweb/core/tests/test_search.py,sha256=VryeRI4_5CvnStKOoNoG95M2WTy7Lyy_AhHIDG40M14,2182
428
428
  imio/smartweb/core/tests/test_section_contact.py,sha256=TePnLCLu8pqA4d1SYRK8dGi7m7BbooiTTkQUC4KztAs,24693
429
429
  imio/smartweb/core/tests/test_section_events.py,sha256=7eP-HmXp0D3gvOrjVpzVPmV9nF_PKERnmOGz1G3Z0l0,8641
430
- imio/smartweb/core/tests/test_section_external_content.py,sha256=vCMipaHPBlxI-kg-f90cnkWqUuUDnnyAtsXRP6PhOeo,6674
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
432
432
  imio/smartweb/core/tests/test_section_sendinblue.py,sha256=UmmKo33T9feelumxqeejM4HG4oLRPKJkbB8hkLO144E,2661
433
433
  imio/smartweb/core/tests/test_sections.py,sha256=7lxfneqdJku9sX5u_4Pvg9DWcmMFOE7KH04ojIqdcGQ,24767
@@ -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.76.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
760
- imio.smartweb.core-1.2.76.dist-info/LICENSE.rst,sha256=RzkMFz6AX3-cHd531zd2YQcXai8RIbjFWTs6m66Y5u4,653
761
- imio.smartweb.core-1.2.76.dist-info/METADATA,sha256=4oTZwXWhJLHa5vgVyd2tYKoUJWeSyD0XC7UNbw1xcfw,58462
762
- imio.smartweb.core-1.2.76.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
763
- imio.smartweb.core-1.2.76.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
764
- imio.smartweb.core-1.2.76.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
765
- imio.smartweb.core-1.2.76.dist-info/RECORD,,
759
+ imio.smartweb.core-1.2.77.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
760
+ imio.smartweb.core-1.2.77.dist-info/LICENSE.rst,sha256=RzkMFz6AX3-cHd531zd2YQcXai8RIbjFWTs6m66Y5u4,653
761
+ imio.smartweb.core-1.2.77.dist-info/METADATA,sha256=oi9lNDPCVVv7Rz8ozGcQ8Ns1e_FowTmo-uyltghlnjo,58663
762
+ imio.smartweb.core-1.2.77.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
763
+ imio.smartweb.core-1.2.77.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
764
+ imio.smartweb.core-1.2.77.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
765
+ imio.smartweb.core-1.2.77.dist-info/RECORD,,