|
46 | 46 | send_non_200_response_with_message, |
47 | 47 | ) |
48 | 48 |
|
49 | | -from .always_initialised_recipes import DEFAULT_MULTITENANCY_RECIPE |
50 | | -from supertokens_python.recipe.multitenancy.constants import DEFAULT_TENANT_ID |
51 | 49 |
|
52 | 50 | if TYPE_CHECKING: |
53 | 51 | from .recipe_module import RecipeModule |
@@ -154,6 +152,8 @@ def __init__( |
154 | 152 | mode: Union[Literal["asgi", "wsgi"], None], |
155 | 153 | telemetry: Union[bool, None], |
156 | 154 | ): |
| 155 | + from .always_initialised_recipes import DEFAULT_MULTITENANCY_RECIPE |
| 156 | + |
157 | 157 | if not isinstance(app_info, InputAppInfo): # type: ignore |
158 | 158 | raise ValueError("app_info must be an instance of InputAppInfo") |
159 | 159 |
|
@@ -189,17 +189,18 @@ def __init__( |
189 | 189 | "Please provide at least one recipe to the supertokens.init function call" |
190 | 190 | ) |
191 | 191 |
|
192 | | - multitenancy_found = [False] |
| 192 | + multitenancy_found = False |
193 | 193 |
|
194 | 194 | def make_recipe(recipe: Callable[[AppInfo], RecipeModule]) -> RecipeModule: |
| 195 | + nonlocal multitenancy_found |
195 | 196 | recipe_module = recipe(self.app_info) |
196 | 197 | if recipe_module.get_recipe_id() == "multitenancy": |
197 | | - multitenancy_found[0] = True |
| 198 | + multitenancy_found = True |
198 | 199 | return recipe_module |
199 | 200 |
|
200 | 201 | self.recipe_modules: List[RecipeModule] = list(map(make_recipe, recipe_list)) |
201 | 202 |
|
202 | | - if callable(DEFAULT_MULTITENANCY_RECIPE) and not multitenancy_found[0]: |
| 203 | + if callable(DEFAULT_MULTITENANCY_RECIPE) and not multitenancy_found: |
203 | 204 | recipe = DEFAULT_MULTITENANCY_RECIPE( # pylint: disable=not-callable |
204 | 205 | self.app_info |
205 | 206 | ) |
@@ -259,6 +260,8 @@ async def get_user_count( # pylint: disable=no-self-use |
259 | 260 | include_recipe_ids: Union[None, List[str]], |
260 | 261 | tenant_id: Optional[str] = None, |
261 | 262 | ) -> int: |
| 263 | + from supertokens_python.recipe.multitenancy.constants import DEFAULT_TENANT_ID |
| 264 | + |
262 | 265 | querier = Querier.get_instance(None) |
263 | 266 | include_recipe_ids_str = None |
264 | 267 | if include_recipe_ids is not None: |
@@ -296,6 +299,8 @@ async def get_users( # pylint: disable=no-self-use |
296 | 299 | query: Union[Dict[str, str], None] = None, |
297 | 300 | tenant_id: Optional[str] = None, |
298 | 301 | ) -> UsersResponse: |
| 302 | + from supertokens_python.recipe.multitenancy.constants import DEFAULT_TENANT_ID |
| 303 | + |
299 | 304 | querier = Querier.get_instance(None) |
300 | 305 | params = {"timeJoinedOrder": time_joined_order} |
301 | 306 | if limit is not None: |
|
0 commit comments