Skip to content

Commit 8b072f2

Browse files
committed
feat(context): add metadata to switch_context method
Include metadata parameter in the switch_context method to preserve metadata when switching contexts. refactor(user_endpoint): update auth_router tags Remove "user" tag from auth_router post methods and clean up commented-out logger code.
1 parent 182ffa9 commit 8b072f2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tracardi/context.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ def is_production(self) -> bool:
6565
def context_abrv(self) -> str:
6666
return 'p' if self.production else 't'
6767

68-
def switch_context(self, production, user=None, tenant=None) -> 'Context':
68+
def switch_context(self, production, user=None, tenant=None, metadata=None) -> 'Context':
6969
if user is None:
7070
user = self.user
7171
if tenant is None:
7272
tenant = self.tenant
73-
return Context(production=production, user=user, tenant=tenant)
73+
if metadata is None:
74+
metadata = self.metadata
75+
return Context(production=production, user=user, tenant=tenant, metadata=metadata)
7476

7577
def get_user_less_context_copy(self) -> 'Context':
7678
return Context(

0 commit comments

Comments
 (0)