karrio-server-core 2025.5rc22__py3-none-any.whl → 2025.5rc24__py3-none-any.whl
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.
Potentially problematic release.
This version of karrio-server-core might be problematic. Click here for more details.
- karrio/server/core/dataunits.py +22 -11
- karrio/server/core/serializers.py +20 -0
- karrio/server/samples.py +1 -1
- karrio/server/serializers/abstract.py +6 -2
- {karrio_server_core-2025.5rc22.dist-info → karrio_server_core-2025.5rc24.dist-info}/METADATA +1 -1
- {karrio_server_core-2025.5rc22.dist-info → karrio_server_core-2025.5rc24.dist-info}/RECORD +8 -8
- {karrio_server_core-2025.5rc22.dist-info → karrio_server_core-2025.5rc24.dist-info}/WHEEL +0 -0
- {karrio_server_core-2025.5rc22.dist-info → karrio_server_core-2025.5rc24.dist-info}/top_level.txt +0 -0
karrio/server/core/dataunits.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import logging
|
|
2
2
|
from constance import config
|
|
3
3
|
from django.urls import reverse
|
|
4
4
|
from rest_framework.request import Request
|
|
@@ -31,18 +31,29 @@ NON_HUBS_CARRIERS = [
|
|
|
31
31
|
carrier_name for carrier_name in CARRIER_NAMES if carrier_name not in CARRIER_HUBS
|
|
32
32
|
]
|
|
33
33
|
|
|
34
|
+
LOGGER = logging.getLogger(__name__)
|
|
35
|
+
|
|
34
36
|
|
|
35
37
|
def contextual_metadata(request: Request):
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
38
|
+
# Detect HTTPS from headers (for proxied environments like Caddy/ALB)
|
|
39
|
+
is_https = False
|
|
40
|
+
if hasattr(request, 'META'):
|
|
41
|
+
# Check X-Forwarded-Proto header (set by load balancers/proxies)
|
|
42
|
+
forwarded_proto = request.META.get('HTTP_X_FORWARDED_PROTO', '').lower()
|
|
43
|
+
# Check if request is secure (Django's built-in HTTPS detection)
|
|
44
|
+
is_secure = getattr(request, 'is_secure', lambda: False)()
|
|
45
|
+
is_https = forwarded_proto == 'https' or is_secure
|
|
46
|
+
|
|
47
|
+
if hasattr(request, "build_absolute_uri"):
|
|
48
|
+
_host: str = request.build_absolute_uri(
|
|
49
|
+
reverse("karrio.server.core:metadata", kwargs={})
|
|
50
|
+
)
|
|
51
|
+
# Override protocol if we detected HTTPS but build_absolute_uri returned HTTP
|
|
52
|
+
if is_https and _host.startswith('http://'):
|
|
53
|
+
_host = _host.replace('http://', 'https://', 1)
|
|
54
|
+
else:
|
|
55
|
+
_host = "/"
|
|
56
|
+
|
|
46
57
|
host = _host[:-1] if _host[-1] == "/" else _host
|
|
47
58
|
name = lib.identity(
|
|
48
59
|
getattr(conf.settings.tenant, "name", conf.settings.APP_NAME)
|
|
@@ -323,6 +323,26 @@ class CommodityData(serializers.Serializer):
|
|
|
323
323
|
choices=COUNTRIES,
|
|
324
324
|
help_text="The origin or manufacture country",
|
|
325
325
|
)
|
|
326
|
+
product_url = serializers.CharField(
|
|
327
|
+
required=False,
|
|
328
|
+
allow_null=True,
|
|
329
|
+
help_text="The product url",
|
|
330
|
+
)
|
|
331
|
+
image_url = serializers.CharField(
|
|
332
|
+
required=False,
|
|
333
|
+
allow_null=True,
|
|
334
|
+
help_text="The image url",
|
|
335
|
+
)
|
|
336
|
+
product_id = serializers.CharField(
|
|
337
|
+
required=False,
|
|
338
|
+
allow_null=True,
|
|
339
|
+
help_text="The product id",
|
|
340
|
+
)
|
|
341
|
+
variant_id = serializers.CharField(
|
|
342
|
+
required=False,
|
|
343
|
+
allow_null=True,
|
|
344
|
+
help_text="The variant id",
|
|
345
|
+
)
|
|
326
346
|
parent_id = serializers.CharField(
|
|
327
347
|
required=False,
|
|
328
348
|
allow_null=True,
|
karrio/server/samples.py
CHANGED
|
@@ -3,7 +3,7 @@ import pydoc
|
|
|
3
3
|
import typing
|
|
4
4
|
import logging
|
|
5
5
|
from django.db import models
|
|
6
|
-
from django.conf import settings
|
|
6
|
+
from django.conf import empty, settings
|
|
7
7
|
from django.db import transaction
|
|
8
8
|
from rest_framework import serializers
|
|
9
9
|
from django.forms.models import model_to_dict
|
|
@@ -458,7 +458,11 @@ def field_to_serializer(args: dict):
|
|
|
458
458
|
if type == "string":
|
|
459
459
|
return serializers.CharField(
|
|
460
460
|
required=required,
|
|
461
|
-
**(
|
|
461
|
+
**(
|
|
462
|
+
dict(default=default, allow_blank=True, allow_null=True)
|
|
463
|
+
if not required
|
|
464
|
+
else {}
|
|
465
|
+
),
|
|
462
466
|
)
|
|
463
467
|
if type == "integer":
|
|
464
468
|
return serializers.IntegerField(
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
karrio/server/conf.py,sha256=DbO3cm_P9f6Ga9Cd5xaaVso1FhxWTFXgOziI1OEkLqA,1568
|
|
2
2
|
karrio/server/openapi.py,sha256=eQl1fHpWC2WwokBkkb0y7N7zeXHrC-Eba4gob7YLsMA,2411
|
|
3
|
-
karrio/server/samples.py,sha256=
|
|
3
|
+
karrio/server/samples.py,sha256=2BAImCmIrmqhFad08GkPreeTlt04cc4ucn3Nf2HXR8w,9220
|
|
4
4
|
karrio/server/core/__init__.py,sha256=CxNflBwGLO7AIGWybF61j7Mk9-a3iCxSjz2nRaER6BM,140
|
|
5
5
|
karrio/server/core/admin.py,sha256=2h43pTXd3NKV8-_fkUEkzkS4zqih0qBLE8q6Yj7fpEg,33
|
|
6
6
|
karrio/server/core/apps.py,sha256=VKRPRoB2YY1JlEpCe2AE6k57M1qkPADfq5RYZuLjEOw,211
|
|
7
7
|
karrio/server/core/authentication.py,sha256=NiXbfcz3SJjYSKBGLT9-HRYATZXfPRuyALS5bzpNT9U,10555
|
|
8
8
|
karrio/server/core/context_processors.py,sha256=B80cJ_7-uviNRYyrfsCcOaUQFBf_eAgQ0hHZPtM5Olw,323
|
|
9
9
|
karrio/server/core/datatypes.py,sha256=lM0kKKcEoULrEvpJajbBfiz0xAU4OgOQoiAvalKllNg,10085
|
|
10
|
-
karrio/server/core/dataunits.py,sha256=
|
|
10
|
+
karrio/server/core/dataunits.py,sha256=8yXrsxhGYN-Q7pondiuitcFbnJeTTG2IJmVskzm-SGs,5673
|
|
11
11
|
karrio/server/core/exceptions.py,sha256=AR4FNT_1wkMkuv_ZELB9pVRL3RRWsSJ7hrNgBP7H3EU,6038
|
|
12
12
|
karrio/server/core/fields.py,sha256=5i5eetbxFkIQ9uoFk8k2xPl1mXXnaVKlPV4xwlF3inY,345
|
|
13
13
|
karrio/server/core/filters.py,sha256=nHj742vPWE3Xs_tpwRRVUh00OwxnF22xKfIK7rx-sw4,27434
|
|
@@ -17,7 +17,7 @@ karrio/server/core/oauth_validators.py,sha256=5JxDkXB_HX4a4xJltZcFGukO7o2cUl9h2t
|
|
|
17
17
|
karrio/server/core/permissions.py,sha256=JY3_hTEnyDTWG-weAWPx8xMoaRZwpNL2HaSssBzjH7Y,1189
|
|
18
18
|
karrio/server/core/renderers.py,sha256=IUEUhvvrk_CeqnmnYQgWKHiH3uQhNc0eqDxyO9CuUS4,290
|
|
19
19
|
karrio/server/core/router.py,sha256=IBUR7rfBkdEHQzWxYOPcVSM8NBp3fte9G6Q5BVTUNNw,95
|
|
20
|
-
karrio/server/core/serializers.py,sha256=
|
|
20
|
+
karrio/server/core/serializers.py,sha256=P6mH8pv3gxnq3EzaJkcUzan2Q9O0YbipI9v_y2qkGEk,60749
|
|
21
21
|
karrio/server/core/signals.py,sha256=thHh4K4uP3smWuy9kWavFfdOAttH9xN3og_j4lDWdKM,1742
|
|
22
22
|
karrio/server/core/tests.py,sha256=rmZoZfPBRoMO-U3HtDxeKofnzsfijYeDVQrnw5Mb_dU,3164
|
|
23
23
|
karrio/server/core/urls.py,sha256=JQrN6dI7A7c_M498EcDKdjDqlp_d64Ov-RS4HHmssRk,337
|
|
@@ -163,7 +163,7 @@ karrio/server/providers/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
163
163
|
karrio/server/providers/views/carriers.py,sha256=_uD_soDZDmMxzfu8mQqeLLcDd4ixnE7f8HjoUlybym8,8808
|
|
164
164
|
karrio/server/providers/views/connections.py,sha256=3Y1rfNsZxkn4YBA03WRQiI-y-AC4EYaOGaMjLmCcz1g,6038
|
|
165
165
|
karrio/server/serializers/__init__.py,sha256=TzD3Lt8Gf7VV5ibGITGg5-ki-M8CR0hzZFulcI2ASJM,90
|
|
166
|
-
karrio/server/serializers/abstract.py,sha256=
|
|
166
|
+
karrio/server/serializers/abstract.py,sha256=KmW1s-wODQe5UOROSt5ojRgWdGm9dKQA4Ib-gbm_jPc,15687
|
|
167
167
|
karrio/server/tracing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
168
168
|
karrio/server/tracing/admin.py,sha256=6BZCJiBhJVg3vt8cYx9HF_FgcjanMD42la6bBORlSL8,1904
|
|
169
169
|
karrio/server/tracing/apps.py,sha256=6BfIomUwBV8k7yaypl6kYYAkLSG1aceUmuxvbhw04fI,247
|
|
@@ -198,7 +198,7 @@ karrio/server/user/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
198
198
|
karrio/server/user/templates/registration/login.html,sha256=3_tj-0rKfwkCk-fp_GT8xFQhLqjGcJs3uZzOAaI40Sw,3690
|
|
199
199
|
karrio/server/user/templates/registration/registration_confirm_email.html,sha256=zFDkNN_BHMQyrBv_mU8aoqXxYxG91TGuf6pKwRa5jxE,247
|
|
200
200
|
karrio/server/user/templates/registration/registration_confirm_email.txt,sha256=I_zN_pJTRigfyiYbyQK0wFfrI5Zq1JG8lf0TyLA9fN0,94
|
|
201
|
-
karrio_server_core-2025.
|
|
202
|
-
karrio_server_core-2025.
|
|
203
|
-
karrio_server_core-2025.
|
|
204
|
-
karrio_server_core-2025.
|
|
201
|
+
karrio_server_core-2025.5rc24.dist-info/METADATA,sha256=Ra4PaKLACd7kdEEayDxC9bH7aWnjvbdNQVBvOPowsPo,797
|
|
202
|
+
karrio_server_core-2025.5rc24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
203
|
+
karrio_server_core-2025.5rc24.dist-info/top_level.txt,sha256=D1D7x8R3cTfjF_15mfiO7wCQ5QMtuM4x8GaPr7z5i78,12
|
|
204
|
+
karrio_server_core-2025.5rc24.dist-info/RECORD,,
|
|
File without changes
|
{karrio_server_core-2025.5rc22.dist-info → karrio_server_core-2025.5rc24.dist-info}/top_level.txt
RENAMED
|
File without changes
|