Plomino class reference

Non-exhaustive list of the classes’ methods.



The includes methods inherited from base classes.

callScriptMethod(self, scriptname, methodname, *args)
Calls a method named methodname in a file named scriptname, stored in the resources folder. If the called method allows it, you may pass some arguments.
createDocument(self, docid=None)
Returns a new empty document.
deleteDocument(self, doc)
Delete the document from database.
deleteDocuments(self, ids=None, massive=True)
Batch delete documents from database. If massive is True, the onDelete formula and index updating are not performed (use refreshDB to update).
getAgent(self, agentid)
Return a PlominoAgent, or None.
Returns all the PlominoAgent objects stored in the database.
Returns catalog brains for all the PlominoDocument objects stored in the database.
Returns the current Plone member.
Returns the current user’s access rights.
returns the current user’s roles.
getDocument(self, docid)
Returns the PlominoDocument object corresponding to the identifier, or None.
getForm(self, formname)
returns the PlominoForm object corresponding to the identifier.
returns all the PlominoForm objects stored in the database.
returns the PlominoIndex object.
returns the Plone site groups.
returns the Plone site members.
returns the Plone site member ids.
returns the Plone site groups ids and all the Plone site members ids.
returns all the roles declared in the database.
getUsersForRight(self, right)
returns the users declared in the ACL and having the given right.
returns the users declared in the ACL and having the given role.
getView(self, viewname)
return the PlominoView object corresponding to the identifier.
returns all the PlominoView objects stored in the database.
hasUserRole(self, userid, role)
Returns True if the specified user id has the given role.
processImportAPI(self, formName, separator, fileToImport, file_encoding='utf-8')
Import a CSV file to create document using the specified form.
isCurrentUserAuthor(self, doc)
returns True if the current user is author of the given document or has the PlominoAuthor right.
refresh the database index and the formulas.
writeMessageOnPage(self, infoMsg, REQUEST, ifMsgEmpty = '', error = False)
displays a standard Plone status message. The REQUEST parameter is mandatory. Most of the time, plominoDocument.REQUEST will be the correct value. ifMsgEmpty is the default message to display if infoMsg is empty. If error is False, the message displays as an informational message; if True, it displays as an error message.


delete(self, REQUEST=None)
deletes the document, and if REQUEST contains a key named returnurl, uses its value to redirect the client.
deleteAttachment(self, REQUEST)
remove file object and update corresponding item value.
getfile(self, filename=None, REQUEST=None)
return the file corresponding to the given filename.
return the filenames of all the files stored with the document.
returns the form given by the view form formula (if the document is opened from a view and if the view has a form formula), else returns the form given by the document’s Form item.
getItem(self, name, default='')
returns the item value if it exists, else returns the default value (an empty string if not provided).
getItemClassname(self, name)
returns the class name of the item .
returns the names of all the items existing in the document.
Normally used via acquisition by Plomino formulas operating on documents, forms, etc.
getRenderedItem(self, itemname, form=None, convertattachments=False)
returns the item value using the rendering corresponding to the field type defined in the form (if form is None, it uses the form returned by getForm()). If convertattachments is True, FileAttachments items are converted to text (if possible).
hasItem(self, name)
returns True if the item exists in the document.
returns True if the current user is author of the document or has the PlominoAuthor right.
returns True is the document is being edited, False if it is being read. Note the same method is available in PlominoForm, so it can be used transparently in any formula to know if the document is being edited or not.
returns False (because an existing document is necessarily not new). Note the same method is available in PlominoForm (and returns True), so it can be used transparently in any formula to know if the document is being created or not.
openWithForm(self, form, editmode=False)
display the document using the given form’s layout (but first, check if the user has proper access rights).
removeItem(self, name)
remove the item.
save(self, form=None, creation=False, refresh_index=True)
refresh the computed fields and re-index the document in the Plomino index and in the Plone portal_catalog (only if refresh_index is True; False might be useful to improve the performance, but a refreshDatabase will be needed). It uses the field’s formulas defined in the provided form (by default, it uses the form returned by getForm()).
send(self, recipients, title, form=None)
send the document by mail to the recipients. The document is rendered in HTML using the provided form (by default it uses the form returned by getForm()).
set the value (if the item does not exist, it is created).


returns the form id.
returns the PlominoDatabase object which contains the form.

returns True.


the same method is available in PlominoDocument, so it can be used transparently in any formula to know if the document is being edit or not.


returns True (when the context is a form, it is necessarily a new doc).


the same method is available in PlominoDocument (and returns False), so it can be used transparently in any formula to know if the document is being created or not.


exportCSV(self, REQUEST=None)
returns the columns values in CSV format. If REQUEST is not None, download is proposed to the user.
returns all the documents which match the Selection Formula. Documents are sorted according the sort column (if defined).
getDocumentsByKey(self, key)
returns all documents for which the value of the column used as sort key matches the given key.
returns the PlominoDatabase object which contains the view.
returns the view id.


dbsearch(self, request, sortindex, reverse=0)
searches the documents corresponding to the request (see ZCatalog reference). The returned objects are ZCatalog brains pointing to the documents (see ZCatalog reference).
getKeyUniqueValues(self, key)
returns the list of distinct values for an indexed field.
returns the PlominoDatabase object which contains the index.
refresh the index.



PlominoUtils is imported for any formula execution, its methods are always available (importing the module is not needed).

Another module with some useful methods is Products.PythonScripts.standard, which can be imported if needed.

actual_context(context, search="PlominoDocument")
return the actual context from the request, it will drill into the path until it find a context matching the searched class. Useful in portlet context
return the actual path from the request. Useful in portlet context
array_to_csv(array, delimiter='\t', quotechar='"')
Convert array (a list of lists) to a CSV string.
If not list, return x in a single-element list. .. note:: If x is None, this will return [None].
Make sure s is unicode, decode according to site encoding if needed.
csv_to_array(csvcontent, delimiter='\t', quotechar='"')
Convert CSV to array. csvcontent may be a string or a file.
DateRange(d1, d2)
returns the dates of all the days between the 2 dates.
DateToString(d, format=None, db=None)
Converts a date to a string. If db is passed, use the database date format.
Replaces unicode characters with their corresponding HTML entities.
Test if the object is a PlominoDocument. Useful to distinguish a document context from a form context.

Return the object as a string using the JSON format. Example:

>>> json_dumps({"a": [1, 2, "This is a 'quote'"], "b": 0.098098})
'{"a": [1, 2, "This is a \'quote\'"], "b": 0.098098}'

Build an object from a JSON string. Example:

>>> json_loads('{"a": [1, 2, "This is a \'quote\'"], "b": 0.098098}')
{u'a': [1, 2, u"This is a 'quote'"], u'b': 0.098098}
Log(message, summary='', severity='info', exc_info=False)
Write a message to the server event log.
returns current date and time as a DateTime object.
open_url(url, asFile=False, data=None)

Load the corresponding url, and retrurn the resulting string (or a stream if asFile is True). If data is not None, it will produce a POST request (and data will be url encoded if it is not a string). IMPORTANT: By default, open_url raises an Unauthorized exception. If the requested domain (note: it might also be a local path) has been declared safe by an local module, it retrieves the content from url. To declare a domain as safe:

from zope.interface import implements
from zope.component import provideUtility
from Products.CMFPlomino.interfaces import IPlominoSafeDomains

class MySafeDomains:

    domains = [
provideUtility(MySafeDomains, IPlominoSafeDomains)
PlominoTranslate(message, context, domain='CMFPlomino')
translate the given message using the Plone i18n engine (using the given domain).
sendMail(db, recipients, title, message_in, sender=None, cc=None, bcc=None, immediate=False, msg_format='html')
Send a mail to the recipients. If sender is None, it will use the current user mail address. By default it accepts a html message, you can submit text instead and supply msg_format=’text’.
StringToDate(str_d, format='%Y-%m-%d', db=None)
Converts a string to a date. If db is passed, use the database date format. If format=None, guess.
PlominoTranslate(msgid, context, domain='CMFPlomino')
Look up the translation for msgid in the current language.

Convert a dictionary into a URL querystring (a key=value& string). Example:

>>> urlencode({"option": 5, "article": "9879879"})

Replace special characters in a string using the %xx escape. Example:

>>> urlquote('runAgent?REDIRECT=True&action=accept')
userFullname(db, userid)
returns the user full name.
userInfo(db, userid)
returns the Member object corresponding to the user id (it may be used to get the user email address for instance).


returns the PlominoDatabase object which contains the agent.
runAgent(self, REQUEST=None)
runs the agent. If REQUEST is provided, there is a redirection to the database home page, unless the REQUEST contains a REDIRECT key If so, the formula returned value is used as the redirection URL.
if agents are called from Python code, they can take positional arguments.