cardo-python-utils 0.5.2__tar.gz → 0.5.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cardo_python_utils-0.5.2/cardo_python_utils.egg-info → cardo_python_utils-0.5.4}/PKG-INFO +1 -1
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4/cardo_python_utils.egg-info}/PKG-INFO +1 -1
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/pyproject.toml +1 -1
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/admin/user_group.py +3 -3
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/models/user_group.py +1 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/tenant_context.py +2 -2
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/LICENSE +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/MANIFEST.in +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/README.rst +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/cardo_python_utils.egg-info/SOURCES.txt +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/cardo_python_utils.egg-info/dependency_links.txt +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/cardo_python_utils.egg-info/requires.txt +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/cardo_python_utils.egg-info/top_level.txt +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/choices.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/data_structures.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/db.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/README.md +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/admin/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/admin/auth.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/admin/templates/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/admin/templates/user_groups_changelist.html +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/admin/views.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/api/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/api/drf.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/api/ninja.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/api/utils.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/apps.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/auth/service.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/celery/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/celery/tenant_aware_database_scheduler.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/celery/tenant_aware_task.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/db/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/db/alias.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/db/routers.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/db/transaction.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/db/utils.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/management/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/management/commands/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/management/commands/migrateall.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/management/commands/shell.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/management/commands/showmigrations.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/management/commands/tenant_aware_command.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/middleware/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/middleware/tenant_aware_http_middleware.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/middleware/tenant_aware_websocket_middleware.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0001_initial.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0001_initial_squashed_0005_alter_userrole_id.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0002_auto_20220120_1617.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0003_auto_20220513_1025.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0004_auto_20220817_1526.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0005_alter_userrole_id.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0006_userrole_organization_and_more.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0007_user_demo.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0008_delete_userrole.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/models/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/models/user.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/oidc_settings.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/redis/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/redis/key_function.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/settings.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/storage/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/storage/tenant_aware_storage.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/tests/__init__.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/tests/conftest.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django_utils.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/esma_choices.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/exceptions.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/imports.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/math.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/text.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/time.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/types_hinting.py +0 -0
- {cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/setup.cfg +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cardo-python-utils"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.4"
|
|
8
8
|
description = "Python library enhanced with a wide range of functions for different scenarios."
|
|
9
9
|
readme = "README.rst"
|
|
10
10
|
requires-python = ">=3.8"
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/admin/user_group.py
RENAMED
|
@@ -70,9 +70,9 @@ class UserGroupAdminBase(admin.ModelAdmin, metaclass=UserGroupAdminMetaclass):
|
|
|
70
70
|
def get_queryset(self, request):
|
|
71
71
|
queryset = super().get_queryset(request)
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
queryset = queryset.annotate(**{
|
|
74
|
+
f"allowed_{entity}_count": Count(f"allowed_{entity}") for entity in self.app_entities
|
|
75
|
+
})
|
|
76
76
|
|
|
77
77
|
return queryset
|
|
78
78
|
|
|
@@ -68,14 +68,14 @@ class TenantContext(ContextDecorator):
|
|
|
68
68
|
def set(tenant):
|
|
69
69
|
if TenantContext.is_set():
|
|
70
70
|
# If the tenant is already set, we do not allow to set it
|
|
71
|
-
# again unless it is the same value.
|
|
71
|
+
# again unless it is the same value or ALLOW_TENANT_CONTEXT_CHANGE is True.
|
|
72
72
|
# This is to prevent the tenant to be set to a different
|
|
73
73
|
# value in the same thread.
|
|
74
74
|
# A request-response cycle is required to set the tenant
|
|
75
75
|
# only once and operate on the same tenant in its lifecycle.
|
|
76
76
|
# The same applies to a single task, it is not allowed to set the
|
|
77
77
|
# tenant in the same task to a different value.
|
|
78
|
-
if TenantContext.get() != tenant:
|
|
78
|
+
if TenantContext.get() != tenant and not getattr(settings, "ALLOW_TENANT_CONTEXT_CHANGE", False):
|
|
79
79
|
raise RuntimeError(
|
|
80
80
|
f"Tenant context already set to '{TenantContext.get()}', "
|
|
81
81
|
f"cannot change to '{tenant}' within the same request/task lifecycle."
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/cardo_python_utils.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/cardo_python_utils.egg-info/requires.txt
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/cardo_python_utils.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/celery/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/management/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/middleware/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/0001_initial.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/migrations/__init__.py
RENAMED
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/redis/key_function.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardo_python_utils-0.5.2 → cardo_python_utils-0.5.4}/python_utils/django/storage/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|