Skip to content

Commit

Permalink
Remove deprecation warning for INameFromTitle as it breaks some use c…
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Oct 31, 2023
1 parent 9a9dbf3 commit ccc85f6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
5 changes: 5 additions & 0 deletions news/3858.internal
@@ -0,0 +1,5 @@
Mark ``INameFromTitle`` deprecated, in this distribution, as it has been moved to ``plone.base``.
It will be removed in Plone 7.0.
We do not show a deprecation warning, because doing so would break content types with this interface name in the behaviors list.
Recommended is to use ``plone.namefromtitle`` as behavior name, then it works in all supported Plone versions.
[gforcada]
4 changes: 0 additions & 4 deletions news/3858.internal.2

This file was deleted.

28 changes: 22 additions & 6 deletions plone/app/content/interfaces.py
@@ -1,14 +1,30 @@
from plone.base.interfaces import INameFromTitle as FutureINameFromTitle
from zope.interface import Attribute
from zope.interface import Interface

import zope.deferredimport

class INameFromTitle(FutureINameFromTitle):
"""An object that supports getting its name (id) from its title.
zope.deferredimport.deprecated(
"It has been moved to plone.base.interfaces. "
"This alias will be removed in Plone 7.0",
INameFromTitle="plone.base.interfaces:INameFromTitle",
)
This interface has been moved to plone.base.interfaces.
This alias will be removed in Plone 7.0.
We tried deprecating it like this:
zope.deferredimport.deprecated(
INameFromTitle="plone.base.interfaces:INameFromTitle",
)
Unfortunately this does not completely work: if your site has a content
type with behavior `plone.app.content.interfaces.INameFromTitle` this would
no longer work because the behavior is not found.
If you use `plone.namefromtitle` then it works.
So as long as we want to support the old spelling, we must keep the
interface here, and also use this interface as the `provides` in the
definition of the behavior in `plone.app.dexterity`.
See https://github.com/plone/plone.app.dexterity/pull/379
"""


class IReindexOnModify(Interface):
Expand Down

0 comments on commit ccc85f6

Please sign in to comment.