We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b207db6 commit eeff1c4Copy full SHA for eeff1c4
__init__.py
@@ -1,19 +1,18 @@
1
-
2
def get(key):
3
from .models import Setting
4
import json
5
# key can be "alerting.ficon.*" or without asterisk
6
# value can be a plain string or a json object
7
+
8
if len(key) == 0:
9
raise Exception("An empty key was received")
10
11
if key[-1] == "*":
12
d = {}
13
for s in Setting.objects.filter(key__startswith = key[:-1]):
14
d.update({s.key: json.loads(s.value)})
15
return d
16
17
# let it raise an exception if the key is not found
18
return json.loads(Setting.objects.get(key = key).value)
19
@@ -33,4 +32,4 @@ def all():
33
32
34
for s in Setting.objects.all():
35
36
- return d
+ return d
0 commit comments