Ticket #9580 (closed PLIP: duplicate)
Expand variable substitution in mailing action of plone.app.contentrules
Reported by: | dukebody | Owned by: | optilude |
---|---|---|---|
Priority: | minor | Milestone: | 4.0 |
Component: | Content Rules | Version: | |
Keywords: | Cc: |
Description
http://plone.org/products/plone/roadmap/253
The mail action in plone.app.contentrules offers simple ${} style substitution for title and url. The variable list should be expanded to include workflow state and change note at a minimum and possibly several other metadata variables.
Proposed by
Steve McMahon
Seconded by
Matthew Wilkes
Proposal type
User interface
State
being-discussed
Motivation
Consider an e-mail notification sent of workflow state change. What's the thing that the person receiving the email is likely to want to know first (after title and URL)? The new state.
There are several other bits of metadata that might be similarly useful: who's the creator, who's making the change, etc. Integrators who want to use the content rule infrastructure for notification emails can't reuse the mail action for complex, site-specific notifications; they must currently write a new action.
Assumptions
That a compent architecture lookup to convert the values does not introduce a performance penalty greater than the flexibility it offers justifies.
Proposal
- Survey metadata fields and determine which are appropriate for inclusion (i.e. fields that might be generally useful)
- Modify the current implementation of mailer to allow for specially fields strings to trigger adapter lookups against the event that caused them
- Convert the current tag implementations to very simple adapters
- Vet for security issues in exposing more information by default
- Improve test coverage to ensure undefined variables fail safe, like the current implementation
- Document in the interface and Plone.Org documentation.
Implementation
This is close to trivial. The adapters should adapt the appropriate event and context that triggered the content rule and return an IVariableContent (or similar) which is then used to replace the string that triggered it.
Deliverables
Updates to plone.app.contentrules/actions/mail.py. Update to user interface for content-rules management to make it clear what substitutions are available, and how they're used. Unit tests to prove implementation fails safe, and that we respect localisation where possible/appropriate in our default implementations.
Risks
Complication of user interface for content-rules management. It is also assumed that anyone currently using content rules is not using strings of the form ${changenote} &c. in their emails, and expecting those strings to be returned not interpolated. If that is incorrect some emails would return the incorrect content.
An updated version of this PLIP, #9256, was approved for inclusion in Plone 4.0.