Skip to content

Commit

Permalink
Formatted Code
Browse files Browse the repository at this point in the history
  • Loading branch information
yubarajshrestha committed Jul 8, 2022
1 parent 49dba77 commit 35d762d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/multitenancy/middlewares/tenant_finder_middleware.py
@@ -1,14 +1,19 @@
from masonite.middleware import Middleware
from ..models.Tenant import Tenant


class TenantFinderMiddleware(Middleware):
"""Middleware to find the tenant for the current request."""

def before(self, request, response):
from wsgi import application

"""Find the tenant for the current request."""
tenant = Tenant.where("domain", request.get_host()).or_where("database", request.get_subdomain()).first()
tenant = (
Tenant.where("domain", request.get_host())
.or_where("database", request.get_subdomain())
.first()
)
if tenant:
request.tenant = tenant
tenancy = application.make("multitenancy")
Expand Down

0 comments on commit 35d762d

Please sign in to comment.