collective.tiles.carousel 1.0.3__py3-none-any.whl → 1.1.0__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,4 +1,5 @@
1
1
  """Init and utils."""
2
+
2
3
  from zope.i18nmessageid import MessageFactory
3
4
 
4
5
 
@@ -23,13 +23,12 @@
23
23
 
24
24
  *** Settings *****************************************************************
25
25
 
26
- Resource plone/app/robotframework/selenium.robot
27
- Resource plone/app/robotframework/keywords.robot
26
+ Resource plone/app/robotframework/browser.robot
28
27
 
29
28
  Library Remote ${PLONE_URL}/RobotRemote
30
29
 
31
- Test Setup Open test browser
32
- Test Teardown Close all browsers
30
+ Test Setup Run keywords Plone Test Setup
31
+ Test Teardown Run keywords Plone Test Teardown
33
32
 
34
33
 
35
34
  *** Test Cases ***************************************************************
@@ -47,20 +46,19 @@ Scenario: As a member I want to be able to log into the website
47
46
 
48
47
  a login form
49
48
  Go To ${PLONE_URL}/login_form
50
- Wait until page contains Login Name
51
- Wait until page contains Password
49
+ Get Text //body contains Login Name
50
+ Get Text //body contains Password
52
51
 
53
52
 
54
53
  # --- WHEN -------------------------------------------------------------------
55
54
 
56
55
  I enter valid credentials
57
- Input Text __ac_name admin
58
- Input Text __ac_password secret
59
- Click Button Log in
56
+ Type Text //input[@name="__ac_name"] admin
57
+ Type Text //input[@name="__ac_password"] secret
58
+ Click //button[contains(text(), "Log in")]
60
59
 
61
60
 
62
61
  # --- THEN -------------------------------------------------------------------
63
62
 
64
63
  I am logged in
65
- Wait until page contains You are now logged in
66
- Page should contain You are now logged in
64
+ Get Text //body contains You are now logged in
@@ -1,4 +1,5 @@
1
1
  """Setup tests for this package."""
2
+
2
3
  from collective.tiles.carousel.testing import (
3
4
  COLLECTIVE_TILES_CAROUSEL_INTEGRATION_TESTING,
4
5
  )
@@ -7,10 +7,7 @@ from plone import api
7
7
  from plone.app.contenttypes.browser.link_redirect_view import NON_RESOLVABLE_URL_SCHEMES
8
8
  from plone.app.contenttypes.interfaces import ICollection
9
9
  from plone.app.contenttypes.utils import replace_link_variables_by_paths
10
- from plone.app.querystring import queryparser
11
- from plone.app.querystring.interfaces import IParsedQueryIndexModifier
12
10
  from plone.app.z3cform.widgets.querystring import QueryStringFieldWidget
13
- from plone.app.z3cform.widgets.relateditems import RelatedItemsFieldWidget
14
11
  from plone.autoform import directives as form
15
12
  from plone.dexterity.interfaces import IDexterityContainer
16
13
  from plone.memoize import view
@@ -22,7 +19,6 @@ from z3c.relationfield.schema import RelationChoice
22
19
  from z3c.relationfield.schema import RelationList
23
20
  from zope import schema
24
21
  from zope.component import getMultiAdapter
25
- from zope.component import getUtilitiesFor
26
22
  from zope.component import getUtility
27
23
  from zope.interface import alsoProvides
28
24
  from zope.interface import implementer
@@ -33,6 +29,16 @@ from zope.schema.vocabulary import SimpleTerm
33
29
  from zope.schema.vocabulary import SimpleVocabulary
34
30
 
35
31
 
32
+ try:
33
+ from plone.app.z3cform.widgets.contentbrowser import (
34
+ ContentBrowserFieldWidget as CarouselItemsWidget,
35
+ )
36
+ except ImportError:
37
+ from plone.app.z3cform.widgets.relateditems import (
38
+ RelatedItemsFieldWidget as CarouselItemsWidget,
39
+ )
40
+
41
+
36
42
  @provider(IContextSourceBinder)
37
43
  def image_scales(context):
38
44
  """Return custom source for image scales.
@@ -77,11 +83,12 @@ class ISliderTile(Schema):
77
83
 
78
84
  form.widget(
79
85
  "carousel_items",
80
- RelatedItemsFieldWidget,
86
+ CarouselItemsWidget,
81
87
  vocabulary="plone.app.vocabularies.Catalog",
82
88
  pattern_options={
83
89
  "orderable": True,
84
90
  "recentlyUsed": True,
91
+ "upload": True,
85
92
  },
86
93
  )
87
94
 
@@ -248,37 +255,10 @@ class SliderTile(Tile):
248
255
  values.append(name)
249
256
  return values
250
257
 
251
- def parse_query_from_data(data, context=None):
252
- """Parse query from data dictionary"""
253
- if context is None:
254
- context = api.portal.get()
255
- query = data.get("query", {}) or {}
256
- try:
257
- parsed = queryparser.parseFormquery(context, query)
258
- except KeyError:
259
- parsed = {}
260
-
261
- index_modifiers = getUtilitiesFor(IParsedQueryIndexModifier)
262
- for name, modifier in index_modifiers:
263
- if name in parsed:
264
- new_name, query = modifier(parsed[name])
265
- parsed[name] = query
266
- # if a new index name has been returned, we need to replace
267
- # the native ones
268
- if name != new_name:
269
- del parsed[name]
270
- parsed[new_name] = query
271
-
272
- if data.get("sort_on"):
273
- parsed["sort_on"] = data["sort_on"]
274
- if data.get("sort_reversed", False):
275
- parsed["sort_order"] = "reverse"
276
- return parsed
277
-
278
258
  @property
279
259
  def items(self):
280
260
  items = OrderedDict()
281
- if "carousel_items" in self.data:
261
+ if len(self.data.get("carousel_items") or []):
282
262
  for item in self.data["carousel_items"]:
283
263
  if ICollection.providedBy(item.to_object):
284
264
  items.update(
@@ -309,16 +289,19 @@ class SliderTile(Tile):
309
289
  else:
310
290
  items[item.to_object] = None
311
291
 
312
- if getattr(self, "query", None):
292
+ query = self.query
293
+ if query:
313
294
  items.update(
314
- OrderedDict.fromkeys(
315
- [x.getObject() for x in api.content.find(**self.query)]
316
- )
295
+ OrderedDict.fromkeys([x.getObject() for x in self.catalog(**query)])
317
296
  )
297
+
318
298
  result = []
319
- for obj in items.keys():
299
+ limit = self.data.get("limit") or 12
300
+ for count, obj in enumerate(items.keys(), 1):
320
301
  result.append(obj)
321
- ips = self.data.get("items_per_slide", 1)
302
+ if count >= limit:
303
+ break
304
+ ips = self.data.get("items_per_slide", 1) or 1
322
305
  slides = [
323
306
  result[i : i + ips]
324
307
  for i in [x * ips for x in range(0, int(len(result) / ips) + int(1))]
@@ -2,8 +2,6 @@
2
2
 
3
3
  from plone import api
4
4
  from plone.app.querystring import queryparser
5
- from plone.app.querystring.interfaces import IParsedQueryIndexModifier
6
- from zope.component import getUtilitiesFor
7
5
 
8
6
 
9
7
  def parse_query_from_data(data, context=None):
@@ -12,25 +10,13 @@ def parse_query_from_data(data, context=None):
12
10
  context = api.portal.get()
13
11
  query = data.get("query", {}) or {}
14
12
  try:
15
- parsed = queryparser.parseFormquery(context, query)
13
+ parsed = queryparser.parseAndModifyFormquery(
14
+ context,
15
+ query,
16
+ data.get("sort_on"),
17
+ "desc" if data.get("sort_reversed", False) else "asc",
18
+ )
16
19
  except KeyError:
17
20
  parsed = {}
18
21
 
19
- index_modifiers = getUtilitiesFor(IParsedQueryIndexModifier)
20
- for name, modifier in index_modifiers:
21
- if name in parsed:
22
- new_name, query = modifier(parsed[name])
23
- parsed[name] = query
24
- # if a new index name has been returned, we need to replace
25
- # the native ones
26
- if name != new_name:
27
- del parsed[name]
28
- parsed[new_name] = query
29
-
30
- if data.get("sort_on"):
31
- parsed["sort_on"] = data["sort_on"]
32
- if data.get("limit"):
33
- parsed["sort_limit"] = data["limit"]
34
- if data.get("sort_reversed", False):
35
- parsed["sort_order"] = "reverse"
36
22
  return parsed
@@ -0,0 +1,2 @@
1
+ import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('collective',));importlib = __import__('importlib.util');__import__('importlib.machinery');m = sys.modules.setdefault('collective', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('collective', [os.path.dirname(p)])));m = m or sys.modules.setdefault('collective', types.ModuleType('collective'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
2
+ import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('collective', 'tiles'));importlib = __import__('importlib.util');__import__('importlib.machinery');m = sys.modules.setdefault('collective.tiles', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('collective.tiles', [os.path.dirname(p)])));m = m or sys.modules.setdefault('collective.tiles', types.ModuleType('collective.tiles'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p);m and setattr(sys.modules['collective'], 'tiles', m)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: collective.tiles.carousel
3
- Version: 1.0.3
3
+ Version: 1.1.0
4
4
  Summary: Slider for plone.app.mosaic based on Bootstrap 5
5
5
  Home-page: https://github.com/collective/collective.tiles.carousel
6
6
  Author: Peter Holzer
@@ -41,12 +41,12 @@ Requires-Dist: plone.tiles
41
41
  Requires-Dist: plone.api
42
42
  Requires-Dist: z3c.relationfield
43
43
  Provides-Extra: test
44
- Requires-Dist: plone.app.dexterity ; extra == 'test'
45
- Requires-Dist: plone.app.testing ; extra == 'test'
46
- Requires-Dist: plone.browserlayer ; extra == 'test'
47
- Requires-Dist: plone.testing ; extra == 'test'
48
- Requires-Dist: plone.app.robotframework[debug] ; extra == 'test'
49
- Requires-Dist: robotsuite ; extra == 'test'
44
+ Requires-Dist: plone.app.dexterity; extra == "test"
45
+ Requires-Dist: plone.app.testing; extra == "test"
46
+ Requires-Dist: plone.browserlayer; extra == "test"
47
+ Requires-Dist: plone.testing; extra == "test"
48
+ Requires-Dist: plone.app.robotframework[debug]; extra == "test"
49
+ Requires-Dist: robotsuite; extra == "test"
50
50
 
51
51
  .. This README is meant for consumption by humans and pypi. Pypi can render rst files so please do not use Sphinx features.
52
52
  If you want to learn more about writing documentation, please check out: http://docs.plone.org/about/documentation_styleguide.html
@@ -108,6 +108,23 @@ Changelog
108
108
  =========
109
109
 
110
110
 
111
+ 1.1.0 (2024-12-12)
112
+ ------------------
113
+
114
+ - Use new `ContentBrowserWidget` for Plone 6.1.
115
+ [petschki]
116
+
117
+
118
+ 1.0.4 (2024-05-02)
119
+ ------------------
120
+
121
+ - Fix ``limit``.
122
+ [petschki]
123
+
124
+ - code cleanup.
125
+ [petschki]
126
+
127
+
111
128
  1.0.3 (2023-11-03)
112
129
  ------------------
113
130
 
@@ -1,12 +1,12 @@
1
- collective.tiles.carousel-1.0.3-py3.11-nspkg.pth,sha256=Vq44M1ox8wdw3b0VK_LUaGmCPYCr7x699rOAClrxCbs,1762
2
- collective/tiles/carousel/__init__.py,sha256=J9-8Hj1ymQi5g5IecTHwgRxzlYuFyIDJDVDoNs3IWjQ,118
1
+ collective.tiles.carousel-1.1.0-py3.12-nspkg.pth,sha256=2oWpeYM6MlxuTCe3-blu86w9h991-Etrc9-2Yn3D6ME,1059
2
+ collective/tiles/carousel/__init__.py,sha256=51V59Yi1aRW6PCzRAoJqUlWno0YQO1wAgi8d37mwTmA,119
3
3
  collective/tiles/carousel/configure.zcml,sha256=1-9Nc4-Lej7b7HJb9Puc8Jw_rDRVyS6agix2SR98wrs,1783
4
4
  collective/tiles/carousel/interfaces.py,sha256=erGd_4DSscSVyQCdzdWNABmPxuUBV1vwKvz6_m5BCc4,249
5
5
  collective/tiles/carousel/setuphandlers.py,sha256=0y1cT8R_eYSdIv-aZUY-pazUGia27EFzCCHC-SiGMrI,586
6
6
  collective/tiles/carousel/testing.py,sha256=WxBe18FLBdf-9nQmw_0rL_Gf1Eu0aLnUDD0RUxJ2VE0,1685
7
7
  collective/tiles/carousel/tile.pt,sha256=ePFsqwYEMYpng21_l8Hp8Ok9-f_KfUKICaq-oJ3n3yc,4737
8
- collective/tiles/carousel/tile.py,sha256=RdOJZBnnxFZzwUFPvR1xrXYBznHgmCh2PI1lzvd_tfA,13295
9
- collective/tiles/carousel/utils.py,sha256=4rKRTdhHtoZyRaP2zdMFFTKpohCZUq_xvRhw9NRAC0M,1176
8
+ collective/tiles/carousel/tile.py,sha256=xAFdH8VOybd7rnhVxJAeAaivpZkwNQmLPgr7QrcZj9Y,12448
9
+ collective/tiles/carousel/utils.py,sha256=M0fOW-m5fhe63I4PtO8jCqnbooZ9ZXctj5in_Ru8j-o,550
10
10
  collective/tiles/carousel/locales/README.rst,sha256=fS2h1MYp7b5Im-GcnIsZLHhK1N4F-_VuHBf_DorI2_A,611
11
11
  collective/tiles/carousel/locales/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  collective/tiles/carousel/locales/collective.tiles.carousel.pot,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -27,13 +27,13 @@ collective/tiles/carousel/slides/slide_view.py,sha256=CiDVVWD_Vcm1JDjruPoR5wJ83g
27
27
  collective/tiles/carousel/slides/static/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  collective/tiles/carousel/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  collective/tiles/carousel/tests/test_robot.py,sha256=VPu3DguHGk-5srPM-N9BZj4dALjotYup8RWZ-QRdbpQ,947
30
- collective/tiles/carousel/tests/test_setup.py,sha256=gzE86929VEpiqhwRkehsMu6ZL3T0-zkIpzZqCw_NJ58,2220
31
- collective/tiles/carousel/tests/robot/test_example.robot,sha256=RjktU-NOhxH3xDxc_Tn91wLAVcuQQ2aNnMEV5oHOKFw,2032
32
- collective.tiles.carousel-1.0.3.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
33
- collective.tiles.carousel-1.0.3.dist-info/LICENSE.rst,sha256=iDVL_6C7byshRvxykg-JJfnJl1UQCvKDV_H-1dp_8GU,668
34
- collective.tiles.carousel-1.0.3.dist-info/METADATA,sha256=k9VFxrkyVwHXYt11qbQDn8v2rrlND_1g9-PmaEa8wUA,3927
35
- collective.tiles.carousel-1.0.3.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
36
- collective.tiles.carousel-1.0.3.dist-info/entry_points.txt,sha256=ru0hdDg0GqdaMNDkHf3l7rtXvCkgCOmh7S-EiRWIpUk,130
37
- collective.tiles.carousel-1.0.3.dist-info/namespace_packages.txt,sha256=AiVC9ju6UYs_UE8dvyfAvQmRsFgWG25eyAfTG-nLAjM,28
38
- collective.tiles.carousel-1.0.3.dist-info/top_level.txt,sha256=FyC0xnd95fkjCaKazR3nfIgNqhWMpB0mYBlzALyXKTg,11
39
- collective.tiles.carousel-1.0.3.dist-info/RECORD,,
30
+ collective/tiles/carousel/tests/test_setup.py,sha256=4FnSh4YBgEbcKTEw-feXs61FYm137R198GQUz4bXFBE,2221
31
+ collective/tiles/carousel/tests/robot/test_example.robot,sha256=5m94vuXTR8NH6qj1s52WlTCj-3Iwgy579yRFX0JG-UE,2053
32
+ collective.tiles.carousel-1.1.0.dist-info/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
33
+ collective.tiles.carousel-1.1.0.dist-info/LICENSE.rst,sha256=iDVL_6C7byshRvxykg-JJfnJl1UQCvKDV_H-1dp_8GU,668
34
+ collective.tiles.carousel-1.1.0.dist-info/METADATA,sha256=WGYnVoEVoNcrCu5inRUvGJtlPRfEN3tydFWJWkf-Zc4,4124
35
+ collective.tiles.carousel-1.1.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
36
+ collective.tiles.carousel-1.1.0.dist-info/entry_points.txt,sha256=ru0hdDg0GqdaMNDkHf3l7rtXvCkgCOmh7S-EiRWIpUk,130
37
+ collective.tiles.carousel-1.1.0.dist-info/namespace_packages.txt,sha256=AiVC9ju6UYs_UE8dvyfAvQmRsFgWG25eyAfTG-nLAjM,28
38
+ collective.tiles.carousel-1.1.0.dist-info/top_level.txt,sha256=FyC0xnd95fkjCaKazR3nfIgNqhWMpB0mYBlzALyXKTg,11
39
+ collective.tiles.carousel-1.1.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.40.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,3 +0,0 @@
1
- import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('collective',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('collective', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('collective', [os.path.dirname(p)])));m = m or sys.modules.setdefault('collective', types.ModuleType('collective'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
2
- import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('collective',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('collective', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('collective', [os.path.dirname(p)])));m = m or sys.modules.setdefault('collective', types.ModuleType('collective'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
3
- import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('collective', 'tiles'));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('collective.tiles', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('collective.tiles', [os.path.dirname(p)])));m = m or sys.modules.setdefault('collective.tiles', types.ModuleType('collective.tiles'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p);m and setattr(sys.modules['collective'], 'tiles', m)