How to access content links from collective.tiles.sliders (an add-on for Mosaic)

Hello! I am trying to customize the collective.tiles.sliders so that I can get links of each slide in the slider. Each slide can get the image and summary of a news, but I could not find the correct TAL definition in the tile.py template.

Should I define some method that extracts a content URL (and possibly a title, if necessary) at base.py? Does someone have a suggestion on how to do it?

Sorry for might beeing off topic (I did not use c.t.sliders) but with GitHub - collective/collective.tiles.carousel you can simply register you own slider template and select it in the tile edit form (apart from some other useful settings). And its in productive use on Plone 6 here :wink:

1 Like

Hi, @petschki. Thank you for the suggestion, it seems promising. I've tried to add this add-on, but I get the error while running the buildout of a Plone 5.2.6:

Couldn't find index page for 'collective.tiles.carousel' (maybe misspelled?)

so I've added:

[sources]
collective.tiles.carousel = git https://github.com/collective/collective.tiles.carousel

It downloaded correctly in the src directory of my Plone instance. When I activated it, I couldn't see the JS loaded. I guessed it could be some conflict with the collective.tiles.sliders, so I've removed it.

Now every time I try to run my buildout, I get the error (the same happened with a minimalplone5)

Installing instance.
While:
  Installing instance.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/home/everton/tmp/minimalplone5/lib/python3.8/site-packages/zc/buildout/buildout.py", line 2174, in main
    getattr(buildout, command)(args)
  File "/home/everton/tmp/minimalplone5/lib/python3.8/site-packages/zc/buildout/buildout.py", line 817, in install
    installed_files = self[part]._call(recipe.install)
  File "/home/everton/tmp/minimalplone5/lib/python3.8/site-packages/zc/buildout/buildout.py", line 1603, in _call
    return f()
  File "/home/everton/tmp/minimalplone5/eggs/plone.recipe.zope2instance-6.10.0-py3.8.egg/plone/recipe/zope2instance/recipe.py", line 155, in install
    installed.extend(self.install_scripts())
  File "/home/everton/tmp/minimalplone5/eggs/plone.recipe.zope2instance-6.10.0-py3.8.egg/plone/recipe/zope2instance/recipe.py", line 949, in install_scripts
    requirements, ws = self.egg.working_set(["plone.recipe.zope2instance"])
  File "/home/everton/tmp/minimalplone5/eggs/zc.recipe.egg-2.0.7-py3.8.egg/zc/recipe/egg/egg.py", line 78, in working_set
    ws = self._working_set(
  File "/home/everton/tmp/minimalplone5/eggs/zc.recipe.egg-2.0.7-py3.8.egg/zc/recipe/egg/egg.py", line 161, in _working_set
    ws = zc.buildout.easy_install.install(
  File "/home/everton/tmp/minimalplone5/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 957, in install
    return installer.install(specs, working_set)
  File "/home/everton/tmp/minimalplone5/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 673, in install
    requirements = [self._constrain(pkg_resources.Requirement.parse(spec))
  File "/home/everton/tmp/minimalplone5/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 673, in <listcomp>
    requirements = [self._constrain(pkg_resources.Requirement.parse(spec))
  File "/home/everton/tmp/minimalplone5/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3148, in parse
    req, = parse_requirements(s)
ValueError: not enough values to unpack (expected 1, got 0)

I've removed all folders from the /eggs directory and also the python packages of my virtualenv on /lib, but this error persists and I cannot run the buildout anymore. Any idea what it could be?

Try to remove the .installed.cfg file.

From a quick view, there's a issue in minimalplone5 because the bootsrap.sh script installs virtualenv for python3 and requirements from 5-latest release but the coredev.cfg gets versions for Plone 5.1 which are not python3 compatible ... with which config do you run minimal plone? try to set the extends URLs version path in coredev.cfg to 5.2 ...

Hi, @tmassman! I tried to remove .installed.cfg, but I get the same error. I also tried to remove this file together with ./eggs, ./develop-eggs and the libraries from my virtualenv directory.

I wonder if it could be some conflict with locally installed python packages (per this discussion)? But this looks weird, since I am using a virtualenv.

everton@butantan: ~/tmp/minimalplone5 â‘‚master* $ source bin/activate
everton@butantan: ~/tmp/minimalplone5 â‘‚master* $ pip list
Package     Version
----------- -------
pip         21.3.1
setuptools  42.0.2
wheel       0.36.2
zc.buildout 2.13.3
everton@butantan: ~/tmp/minimalplone5 â‘‚master* $ pip list | grep -E 'setup|wheel|buildout'
setuptools                    52.0.0
wheel                         0.34.2

NOTE: I've just fixed the versions in the repository ... for me, the buildout runs now without errors

1 Like

@petschki, indeed, the coredev.cfg was changed to Plone 5.1.By changing to the original version 5.2, it solved. Thank you! I have no idea how this happened.

I will come back to test this suggested add-on later today and try to fix my other instance, it must be related.

Ah, okay, I saw your commit.

Just answering myself, I was able to customize the collective.tiles.sliders. I just need to define in this tal:repeat a url image/original that it takes the link of the news with a lead image loaded in the carousel.

I can later when I have time try to add the possibility to add a link in the settings of a slider and send a PR to the main repo.

Plone Foundation Code of Conduct