Get portal url

A shortcut for getting the url of the portal is now always at hand: api.portal.url().

from plone import api
url = api.portal.url()

Get portal object

Getting the Plone portal object is easy with api.portal.get().

from plone import api
portal = api.portal.get()

Get tool

To get a portal tool in a simple way, just use api.portal.get_tool() and pass in the name of the tool you need.

from plone import api
catalog = api.portal.get_tool(name='portal_catalog')

Send E-Mail

To send an e-mail use api.portal.send_email():

    body="One for you Bob!",

Localized time

To display the date/time in a user-friendly way, localized to the user’s prefered language, use api.portal.localized_time().

from plone import api
from DateTime import DateTime
today = DateTime()
api.portal.localized_time(datetime=today, request=request)

Show notification message

With api.portal.show_message() you can show a notification message to the user.

from plone import api
api.portal.show_message(message='Blueberries!', request=request)

Project Versions

Table Of Contents

Previous topic


Next topic


This Page