Coverage for modules/box__default/settings/helpers.py: 27%

# Coverage for modules/box__default/settings/helpers.py : 27%

## 9 statements

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 from .models import Settings

2

3

4 def set_setting(key, value):

5 setting = Settings.query.filter(Settings.setting == key).first()

6 if setting:

7 setting.value = value

8 setting.update()

9

10

11 def get_setting(name):

12 """

13 Used as key-value lookup from Settings table

14

15 Parameters

16 ----------

17 name: str

18 name of key

19

20 Returns

21 -------

22 str

23 value of key

24 """

25 s = Settings.query.get(name)

26 return s.value