Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
87163be5
Commit
87163be5
authored
Dec 18, 2017
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web: add request domain in domain_dict
parent
20900608
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/ERP5Site_getWebSiteDomainDict.py
...em/portal_skins/erp5_web/ERP5Site_getWebSiteDomainDict.py
+21
-2
No files found.
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/ERP5Site_getWebSiteDomainDict.py
View file @
87163be5
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment