Skip to content

Commit d2c8991

Browse files
committed
Add methods to handle internal data for context
1 parent e6e8c46 commit d2c8991

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/satosa/context.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
"""
2-
Holds methods for sending internal data through the satosa proxy
3-
"""
41
from .exception import SATOSAError
52

63

@@ -11,6 +8,9 @@ class SATOSABadContextError(SATOSAError):
118
pass
129

1310

11+
"""
12+
Holds methods for sending internal data through the satosa proxy
13+
"""
1414
class Context(object):
1515
"""
1616
Holds information about the current request.
@@ -60,3 +60,19 @@ def path(self, p):
6060
elif p.startswith('/'):
6161
raise ValueError("path can't start with '/'")
6262
self._path = p
63+
64+
def decorate(self, key, value):
65+
"""
66+
Add information to the context
67+
"""
68+
69+
self.internal_data[key] = value
70+
return self
71+
72+
def get_decoration(self, key):
73+
"""
74+
Retrieve information from the context
75+
"""
76+
77+
value = self.internal_data.get(key)
78+
return value

0 commit comments

Comments
 (0)