plone / plone.resource

publishes directories of static files via the ZPublisher
4 stars 3 forks source link

Fixed ValueError in FilesystemResourceDirectory repr [master] #21

Closed mauritsvanrees closed 6 years ago

mauritsvanrees commented 6 years ago

This is the forward port (cherry-pick) of PR #20 for master.

Fixed 'ValueError: substring not found' in FilesystemResourceDirectory representation.

This happens when you register a directory with a name that differs from the directory name. Visiting the /++theme++myname url would then give this error.

We also avoid listing a longer part of the path in case the directory name happens to be in the path multiple times. Case in point: if you would register the template dir of plone.app.theming as a plone static dir with name theming, and visit the ++theme++theming url, you would see something like this:

<FilesystemResourceDirectory object at theming-1.1.8-py2.7.egg/plone/app/theming/themes/template>

That is just silly. We simply show the name now:

<FilesystemResourceDirectory object at theming>

If the name and the directory would have matched, which is the default when you do not give a name, then that would be what is shown anyway.

mauritsvanrees commented 6 years ago

It fails on 5.1 in an unrelated test:

Module: plone.app.contentlisting.tests.test_integration_unit

ImportError: No module named unittest2

I have opened a PR for that: https://github.com/plone/plone.app.contentlisting/pull/27 [merged now]

mauritsvanrees commented 6 years ago

All three Jenkinses (is that a word?) are happy. Ready for review.