Coverage for /home/runner/work/viur-core/viur-core/viur/src/viur/core/db/config.py: 44%

14 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-09-13 11:04 +0000

1import warnings 

2from viur.core.config import conf as core_conf 

3 

4 

5class DBConfig: 

6 """DEPRECATED""" 

7 """This class only exists for compatibility reasons and this file will be removed in the future""" 

8 _map = { 

9 "traceQueries": [core_conf.debug.trace_queries, "conf.debug.trace_queries"], 

10 "memcache_client": [core_conf.db.memcache_client, "conf.db.memcache_client"] 

11 } 

12 

13 def __setitem__(self, key, value): 

14 if key in self._map: 

15 warnings.warn( 

16 f"db.conf is deprecated and will be removed. Please use {self._map[key][1]} instead", 

17 DeprecationWarning, 

18 stacklevel=3, 

19 ) 

20 self._map[key][0] = value 

21 

22 def __getitem__(self, key): 

23 if key in self._map: 

24 warnings.warn( 

25 f"db.conf is deprecated and will be removed. Please use {self._map[key][1]} instead", 

26 DeprecationWarning, 

27 stacklevel=3, 

28 ) 

29 return self._map[key][0] 

30 

31 

32conf = DBConfig()