-
Notifications
You must be signed in to change notification settings - Fork 17
Sourcery refactored main branch #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,15 +16,17 @@ def split_tenant(path): | |
| if (match := re.search(r'/(.*?)(/.*)', path)): | ||
| return match.groups() | ||
| elif (match := re.search(r'/(.*)', path)): | ||
| if (tenant := match.group(1)): | ||
| if tenant := match[1]: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return tenant, '' | ||
| raise NoTenant(f'No tenant in {path}') | ||
|
|
||
|
|
||
| def tenant_exempt(tenant_name): | ||
| if not hasattr(settings, 'TENANTS_EXEMPT'): | ||
| return False | ||
| return tenant_name in settings.TENANTS_EXEMPT | ||
| return ( | ||
| tenant_name in settings.TENANTS_EXEMPT | ||
| if hasattr(settings, 'TENANTS_EXEMPT') | ||
| else False | ||
| ) | ||
|
Comment on lines
-25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def current_tenant(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,7 @@ def __init__(self, get_response): | |
| def __call__(self, request): | ||
| db = tenant_db_from_request(request) | ||
| setattr(THREAD_LOCAL, "DB", db) | ||
| response = self.get_response(request) | ||
| return response | ||
| return self.get_response(request) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def get_current_db_name(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,3 @@ | |
| @pytest.mark.django_db | ||
| def test_ok(): | ||
| baker.make('core.User') | ||
| assert True | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
TenantAwareQuerySet.as_managerrefactored with the following changes:self(instance-method-first-arg-name)