Skip to content

Commit

Permalink
Use mor python like way for checking assets.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippKilian authored and liske committed Jul 27, 2021
1 parent 51439a8 commit 5b49ff6
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions b3lb/rest/b3lb/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,8 @@ async def join(params, node, secret):
params = await sync_to_async(lb.check_parameter)(params, secret.tenant, join=True)

# check custom style css
if Parameter.USERDATA_BBB_CUSTOM_STYLE_URL not in params:
try:
if secret.tenant.asset and secret.tenant.asset.custom_css:
params[Parameter.USERDATA_BBB_CUSTOM_STYLE_URL] = secret.tenant.asset.custom_css_url
except Asset.DoesNotExist:
pass
if Parameter.USERDATA_BBB_CUSTOM_STYLE_URL not in params and hasattr(secret.tenant, 'asset') and secret.tenant.asset.custom_css:
params[Parameter.USERDATA_BBB_CUSTOM_STYLE_URL] = secret.tenant.asset.custom_css_url

url = "{}{}".format(node.api_base_url, lb.get_endpoint_str("join", params, node.secret))

Expand All @@ -161,21 +157,13 @@ async def create(request, endpoint, params, node, secret):
params = await sync_to_async(lb.check_parameter)(params, secret.tenant)

# check for custom logo
if Parameter.LOGO not in params:
try:
if secret.tenant.asset and secret.tenant.asset.logo:
params["logo"] = secret.tenant.asset.logo_url
except Asset.DoesNotExist:
pass
if Parameter.LOGO not in params and hasattr(secret.tenant, 'asset') and secret.tenant.asset.logo:
params["logo"] = secret.tenant.asset.logo_url

# check for custom slide
if request.method == "GET":
try:
if secret.tenant.asset and secret.tenant.asset.slide:
body = await sync_to_async(lb.get_slide_body_for_post)(secret)
request.method = "POST"
except Asset.DoesNotExist:
pass
if request.method == "GET" and hasattr(secret.tenant, 'asset') and secret.tenant.asset.slide:
body = await sync_to_async(lb.get_slide_body_for_post)(secret)
request.method = "POST"

response = await pass_through(request, endpoint, params, node, body=body)

Expand Down

0 comments on commit 5b49ff6

Please sign in to comment.