You are here: Home / What do you need? / Help and documentation / Plone Info / URL, portal and portal_url

URL, portal and portal_url

by Darrell Kingsley last modified Mar 13, 2014 12:54 PM
Getting the portal URL, or a reference to the portal in a python script is easy

To get a reference to the portal, and then the portal URL after that.

from Products.CMFCore.utils import getToolByName
urltool = getToolByName(context, 'portal_url')
portal = urltool.getPortalObject()

url = portal.absolute_url()

To get the portal URL on its own:

context.portal_url()