Commit 3bf8e434 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Boxiang Sun

erp5_web: add request domain in domain_dict

parent d98310ff
portal = context.getPortalObject()
# TODO: domain names should be exported to a web site property.
# domain_dict = {}
# for web_site in portal_catalog(portal_type="Web Site", validation_state="published"):
# domain = web_site.getDomainName("")
# if domain != "":
# domain_dict[domain] = web_site
# return domain_dict
return {}
domain_dict = {
# "domain.com": object,
}
# Try to add the domain name of the client REQUEST
root_object = portal.restrictedTraverse("/")
root_url = root_object.absolute_url()
if root_url.startswith("https://"):
root_url = root_url[8:]
elif root_url.startswith("http://"):
root_url = root_url[7:]
else:
return domain_dict
domain_end = root_url.find("/")
if domain_end != -1:
root_url = root_url[:domain_end]
if root_url and root_url not in domain_dict:
domain_dict[root_url] = root_object
return domain_dict
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment