Non-exhaustive list of the classes’ methods.
Note
The includes methods inherited from base classes.
callScriptMethod(self, scriptname, methodname, *args)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)deleteDocument(self, doc)deleteDocuments(self, ids=None, massive=True)massive is True, the
onDelete formula and index updating are not performed (use
refreshDB to update).getAgent(self, agentid)getAgents(self)getAllDocuments(self)getCurrentMember(self)getCurrentUserRights(self)getCurrentUserRoles(self)getDocument(self, docid)None.getForm(self, formname)getForms(self)getIndex(self)getPortalGroups(self)getPortalMembers(self)getPortalMembersIds(self)getPortalMembersGroupsIds(self)getUserRoles(self)getUsersForRight(self, right)getUsersForRoles(self,role)getView(self, viewname)getViews(self)hasUserRole(self, userid, role)True if the specified user id has the given role.processImportAPI(self, formName, separator, fileToImport, file_encoding='utf-8')isCurrentUserAuthor(self, doc)True if the current user is author of the given document
or has the PlominoAuthor right.refreshDB(self)writeMessageOnPage(self, infoMsg, REQUEST, ifMsgEmpty = '', error = False)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)REQUEST contains a key named
returnurl, uses its value to redirect the client.deleteAttachment(self, REQUEST)getfile(self, filename=None, REQUEST=None)getFilenames(self)getForm(self)getItem(self, name, default='')getItemClassname(self, name)getItems(self)getParentDatabase(self)getRenderedItem(self, itemname, form=None, convertattachments=False)None, it uses the form
returned by getForm()). If convertattachments is True,
FileAttachments items are converted to text (if possible).hasItem(self, name)True if the item exists in the document.isAuthor(self)True if the current user is author of the document or has
the PlominoAuthor right.isEditMode(self)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.isNewDocument(self)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)removeItem(self, name)save(self, form=None, creation=False, refresh_index=True)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)getForm()).setItem(self,name,value)getFormName(self)getParentDatabase(self)isEditMode(self)returns True.
Note
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.
isNewDocument(self)returns True (when the context is a form, it is necessarily a new
doc).
Note
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)None,
download is proposed to the user.getAllDocuments(self)getDocumentsByKey(self, key)getParentDatabase(self)getViewName(self)dbsearch(self, request, sortindex, reverse=0)getKeyUniqueValues(self, key)getParentDatabase(self)refresh(self)Note
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")actual_path(context)array_to_csv(array, delimiter='\t', quotechar='"')array (a list of lists) to a CSV string.asList(x)x is None, this will return [None].asUnicode(s)s is unicode, decode according to site encoding if needed.csv_to_array(csvcontent, delimiter='\t', quotechar='"')csvcontent may be a string or a file.DateRange(d1, d2)DateToString(d, format=None, db=None)db is passed, use the database
date format.htmlencode(s)isDocument(object)PlominoDocument.
Useful to distinguish a document context from a form context.json_dumps(obj)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}'
json_loads(s)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)Now()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:
implements(IPlominoSafeDomains)
domains = [
"http://api.geonames.org",
"/var/public"
]
provideUtility(MySafeDomains, IPlominoSafeDomains)
PlominoTranslate(message, context, domain='CMFPlomino')sendMail(db, recipients, title, message_in, sender=None, cc=None, bcc=None, immediate=False, msg_format='html')StringToDate(str_d, format='%Y-%m-%d', db=None)db is passed, use the database date
format. If format=None, guess.PlominoTranslate(msgid, context, domain='CMFPlomino')msgid in the current language.urlencode(h)Convert a dictionary into a URL querystring (a key=value& string).
Example:
>>> urlencode({"option": 5, "article": "9879879"})
'article=9879879&option=5'
urlquote(string)Replace special characters in a string using the %xx escape.
Example:
>>> urlquote('runAgent?REDIRECT=True&action=accept')
'runAgent%3FREDIRECT%3DTrue%26action%3Daccept'
userFullname(db, userid)userInfo(db, userid)getParentDatabase(self)runAgent(self, REQUEST=None)__call__(*args)