Skip to content

Commit

Permalink
Fixed deprecation warning for zope.component.interfaces.ComponentLook…
Browse files Browse the repository at this point in the history
…upError

```
DeprecationWarning: ComponentLookupError is deprecated. Import from zope.interface.interfaces
```

And moved some imports out of the try/except ImportError which is only meant for IMarkupSchema.
With the original code, once the backwards compatibility import in zope.component is gone,
we would have gotten an ImportError for it, and the markup schema would not be available.
  • Loading branch information
mauritsvanrees committed Aug 22, 2020
1 parent bcc52c7 commit 348a6cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions news/43.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed deprecation warning for ``zope.component.interfaces.ComponentLookupError``.
[maurits]
6 changes: 3 additions & 3 deletions plone/app/textfield/utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
from plone.registry.interfaces import IRegistry
from Products.CMFCore.utils import getToolByName
from zope.component import getUtility
from zope.component.hooks import getSite
from zope.interface.interfaces import ComponentLookupError


try:
from Products.CMFPlone.interfaces import IMarkupSchema
from plone.registry.interfaces import IRegistry
from zope.component import getUtility
from zope.component.interfaces import ComponentLookupError
except ImportError:
IMarkupSchema = None

Expand Down

0 comments on commit 348a6cb

Please sign in to comment.