Skip to content

Commit

Permalink
Warn about deprecation at runtime (#15)
Browse files Browse the repository at this point in the history
* Document deprecation of this package.
* Document suggested alternatives.
* Warn at runtime about the deprecation status of the package so developers using it can get a hint even when they don't read the readme of this package.
  • Loading branch information
dwt authored and Michael Howitz committed Aug 15, 2019
1 parent c5d99c2 commit 02e2992
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tempstorage/TemporaryStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""
import bisect
from logging import getLogger
import warnings
import time

from ZODB import POSException
Expand Down Expand Up @@ -84,6 +85,14 @@ def __init__(self, name='TemporaryStorage'):
_conflict_cache_maxage -- age at whic conflict cache items are GC'ed
"""
deprecation_warning = """\
DEPRECATED: Usage of the package tempstorage is deprecated, as it is known to randomly lose data.
Especially on Zope 4. For details see https://github.com/zopefoundation/tempstorage/issues/8
and https://github.com/zopefoundation/tempstorage
"""
LOG.warning(deprecation_warning)
warnings.warn(deprecation_warning, DeprecationWarning)

BaseStorage.__init__(self, name)

self._index = {}
Expand Down

0 comments on commit 02e2992

Please sign in to comment.