Commit e0b262d6 authored by Sven Franck's avatar Sven Franck

erp5_web: add root object to ERP5Site_getWebSiteDomainDict for handling absolute urls in mhtml

parent 73471a13
...@@ -5,4 +5,22 @@ ...@@ -5,4 +5,22 @@
# if domain != "": # if domain != "":
# domain_dict[domain] = web_site # domain_dict[domain] = web_site
# return domain_dict # return domain_dict
return {} #return {
# "softinst73908.host.vifib.net": context.getPortalObject().restrictedTraverse("/")
#}
portal = context.getPortalObject()
domain_dict = {
# "domain.com": object,
}
root_object = portal.restrictedTraverse("/")
root_url = root_object.absolute_url()
if root_url.startswith("http://"):
root_url = root_url[7:]
elif root_url.startswith("https://"):
root_url = root_url[8:]
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