Commit a640cb90 authored by Kirill Smelkov's avatar Kirill Smelkov

*: Don't emit warnings on loadBefore

@d-maurer suggests to keep loadBefore without deprecation
(https://github.com/zopefoundation/ZODB/pull/323#pullrequestreview-650963363).

-> Don't emit warnings about deprecating loadBefore.

-> Keep the deprecation text in loadBefore interface, since loadBeforeEx
   should practically provide wider functionality without putting
   unnecessary constraint on storage implementations. In other words
   loadBefore deprecation is still there, but less aggressively
   advertised with the idea to make transition for outside-of-ZODB code
   to loadBeforeEx more smooth and with a bit more steps (we might want
   to reinstate the deprecation warnings at a later time).
parent d968a9a8
...@@ -24,7 +24,6 @@ import os ...@@ -24,7 +24,6 @@ import os
import random import random
import weakref import weakref
import tempfile import tempfile
import warnings
import ZODB.BaseStorage import ZODB.BaseStorage
import ZODB.blob import ZODB.blob
import ZODB.interfaces import ZODB.interfaces
...@@ -228,9 +227,6 @@ class DemoStorage(ConflictResolvingStorage): ...@@ -228,9 +227,6 @@ class DemoStorage(ConflictResolvingStorage):
return ZODB.utils.loadBeforeEx(self.base, oid, before) return ZODB.utils.loadBeforeEx(self.base, oid, before)
def loadBefore(self, oid, before): def loadBefore(self, oid, before):
warnings.warn("loadBefore is deprecated - use loadBeforeEx instead",
DeprecationWarning, stacklevel=2)
data, serial = self.loadBeforeEx(oid, before) data, serial = self.loadBeforeEx(oid, before)
# find out next_serial. # find out next_serial.
......
...@@ -21,7 +21,6 @@ import errno ...@@ -21,7 +21,6 @@ import errno
import logging import logging
import os import os
import time import time
import warnings
from struct import pack from struct import pack
from struct import unpack from struct import unpack
...@@ -594,8 +593,6 @@ class FileStorage( ...@@ -594,8 +593,6 @@ class FileStorage(
return None, h.tid return None, h.tid
def loadBefore(self, oid, tid): def loadBefore(self, oid, tid):
warnings.warn("loadBefore is deprecated - use loadBeforeEx instead",
DeprecationWarning, stacklevel=2)
with self._files.get() as _file: with self._files.get() as _file:
pos = self._lookup_pos(oid) pos = self._lookup_pos(oid)
end_tid = None end_tid = None
......
...@@ -19,7 +19,6 @@ storage without distracting storage details. ...@@ -19,7 +19,6 @@ storage without distracting storage details.
import BTrees import BTrees
import time import time
import warnings
import ZODB.BaseStorage import ZODB.BaseStorage
import ZODB.interfaces import ZODB.interfaces
import ZODB.POSException import ZODB.POSException
...@@ -169,8 +168,6 @@ class MappingStorage(object): ...@@ -169,8 +168,6 @@ class MappingStorage(object):
# ZODB.interfaces.IStorage # ZODB.interfaces.IStorage
@ZODB.utils.locked(opened) @ZODB.utils.locked(opened)
def loadBefore(self, oid, tid): def loadBefore(self, oid, tid):
warnings.warn("loadBefore is deprecated - use loadBeforeEx instead",
DeprecationWarning, stacklevel=2)
tid_data = self._data.get(oid) tid_data = self._data.get(oid)
if tid_data: if tid_data:
before = ZODB.utils.u64(tid) before = ZODB.utils.u64(tid)
......
...@@ -1322,8 +1322,6 @@ class StubStorage(object): ...@@ -1322,8 +1322,6 @@ class StubStorage(object):
return data, serial return data, serial
def loadBefore(self, oid, tid): def loadBefore(self, oid, tid):
warnings.warn("loadBefore is deprecated - use loadBeforeEx instead",
DeprecationWarning, stacklevel=2)
return self._data[oid] + (None, ) return self._data[oid] + (None, )
def store(self, oid, serial, p, version, transaction): def store(self, oid, serial, p, version, transaction):
......
...@@ -20,7 +20,6 @@ storage tests against the test storage. ...@@ -20,7 +20,6 @@ storage tests against the test storage.
""" """
import bisect import bisect
import unittest import unittest
import warnings
from ZODB.BaseStorage import BaseStorage from ZODB.BaseStorage import BaseStorage
from ZODB import POSException from ZODB import POSException
...@@ -106,11 +105,6 @@ class MinimalMemoryStorage(BaseStorage, object): ...@@ -106,11 +105,6 @@ class MinimalMemoryStorage(BaseStorage, object):
self._ltid = self._tid self._ltid = self._tid
def loadBefore(self, the_oid, the_tid): def loadBefore(self, the_oid, the_tid):
warnings.warn("loadBefore is deprecated - use loadBeforeEx instead",
DeprecationWarning, stacklevel=2)
return self._loadBefore(the_oid, the_tid)
def _loadBefore(self, the_oid, the_tid):
# It's okay if loadBefore() is really expensive, because this # It's okay if loadBefore() is really expensive, because this
# storage is just used for testing. # storage is just used for testing.
with self._lock: with self._lock:
...@@ -134,7 +128,7 @@ class MinimalMemoryStorage(BaseStorage, object): ...@@ -134,7 +128,7 @@ class MinimalMemoryStorage(BaseStorage, object):
def loadBeforeEx(self, oid, before): def loadBeforeEx(self, oid, before):
try: try:
r = self._loadBefore(oid, before) r = self.loadBefore(oid, before)
except KeyError: except KeyError:
return None, z64 return None, z64
if r is None: if r is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment