Hello Plone Community. First off, I would like to say that I am new to Plone Development, so please bear with me if this is an impossible task (or a trivial one).
I am trying to call the plone.api.portal.show_message method inside a classless Python file in my add-on in order to display a status message to the user. However, as specified here in the documentation, there is a required "request" parameter. From a significant amount of Googling, I have determined that this refers to a collection of HTTP Request information stored in an object (such as BaseRequest). Am I incorrect in understanding this?
Anyways, when I try to do
from ZPublisher.BaseRequest import BaseRequest
api.portal.show_message('success!', BaseRequest())
in my classless file, I get an error in my Plone site:
TypeError: ('Could not adapt', , <InterfaceClass Products.statusmessages.interfaces.IStatusMessage>)
Does anyone know how I can use plone.api.portal.show_message? I've tried to find example use cases on the internet and I haven't seen anything. My goal by using this method is to display notifications to my users; as a follow-up question, are there alternative ways of doing that in Plone 5 that I should be aware of? Again, I'm sorry if this is an idiotic/obvious question.