Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add docstring to build_absolute_uri

IKarbowiakc4c6832f2a27
diff --git a/saleor/core/utils/__init__.py b/saleor/core/utils/__init__.py
index 7123a3490d..55a46e40c6 100644
--- a/saleor/core/utils/__init__.py
+++ b/saleor/core/utils/__init__.py
@@ -26,6 +26,11 @@ if TYPE_CHECKING:
def build_absolute_uri(location: str) -> Optional[str]:
+ """Create absolute uri from location.
+
+ If provided location is absolute uri by itself, it returns unchanged value,
+ otherwise if provided location is relative, absolute uri is built and returned.
+ """
host = Site.objects.get_current().domain
protocol = "https" if settings.ENABLE_SSL else "http"
current_uri = "%s://%s" % (protocol, host)