Products.CMFPlone/thet-fixtopsitefromurl: Fix utils.get_top_site_from_url to work with non-OFS context
Johannes Raggam <jenkins-z4DKO/[email protected]> Thu, 27 Jul 2017 15:07:53 -0700 (PDT)
| Newsgroups | gmane.comp.web.zope.plone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Repository: Products.CMFPlone Branch: refs/heads/thet-fixtopsitefromurl Date: 2017-07-28T00:07:41+02:00 Author: Johannes Raggam (thet) <[email protected]> Commit: https://github.com/plone/Products.CMFPlone/commit/d52c3810969713c7b12be3450018fa854a266b1b Fix utils.get_top_site_from_url to work with non-OFS contexts. Files changed: M CHANGES.rst M Products/CMFPlone/utils.py diff --git a/CHANGES.rst b/CHANGES.rst index 6235df51a..a11936be7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -29,6 +29,9 @@ Bug fixes: - Fix empty DX add_forms if formlib is also installed thru addon dependencies [MrTango] +- Fix ``utils.get_top_site_from_url`` to work with non-OFS contexts. + [thet] + 5.1b4 (2017-07-03) ------------------ diff --git a/Products/CMFPlone/utils.py b/Products/CMFPlone/utils.py index ff17dc9b5..cf2c0c15d 100644 --- a/Products/CMFPlone/utils.py +++ b/Products/CMFPlone/utils.py @@ -767,10 +767,9 @@ def get_top_site_from_url(context, request): - No virtual hosting, URL path: /Plone/Subsite, Returns: Plone - Virtual hosting roots to Subsite, URL path: /, Returns: Subsite """ - url_path = urlparse(context.absolute_url()).path.split('/') - site = getSite() try: + url_path = urlparse(context.absolute_url()).path.split('/') for idx in range(len(url_path)): _path = '/'.join(url_path[:idx + 1]) or '/' site_path = request.physicalPathFromURL(_path) ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot