Provides ``${id}`` style string interpolation using named adapters to look up variables.
This is meant to provide a trivially simple template system for clients like plone.app.contentrules.
To interpolate a string in context, just follow the pattern::
from plone.stringinterp.interfaces import IStringInterpolator
IStringInterpolator(context)("Here is the title: ${title}")
Substitution of variables that are part of the Dublin Core are provided with the package.
To provide additional substitutions, provide a named adapter implementing ``interfaces.IStringSubstitution`` for your context.
The adapter name is used for the lookup.
You can also wrap your context with ``IContextWrapper`` adapter if you need to pass custom messages within your substitutions.
Implemented Substitutions
=========================
All Content
-----------
- id
- parent_id
- url
- parent_url
Minimal Dublin Core
-------------------
- title
- description
- type (content type)
Workflow Aware
--------------
- review_state
- review_state_title
Dublin Core
-----------
- creator
- creator_fullname
- creator_email
- creators
- creators_emails
- contributors
- contributors_emails
- subject
- format (mime type)
- language
- rights
- identifier
Catalogable Dublin Core
-----------------------
Everything should be in long local time format
- created
- effective
- expires
- modified
Member / Group Information for roles on content
-----------------------------------------------
- owner_emails
- reviewer_emails
- manager_emails
- member_emails
- user_email
Current User Information
------------------------
- user_fullname
- user_id
Last Change (workflow or version) Information
---------------------------------------------
- change_comment
- change_title
- change_type
- change_authorid
Source Code
===========
Contributors please read the document `Process for Plone core's development <https://docs.plone.org/develop/coredev/docs/index.html>`_
Sources and issue tracker are at the `Plone code repository hosted at Github <https://github.com/plone/plone.stringinterp>`_.
Changelog
=========
.. You should *NOT* be adding new change log entries to this file.
You should create a file in the news directory instead.
For helpful instructions, please see:
https://github.com/plone/plone.releaser/blob/master/ADD-A-NEWS-ITEM.rst
.. towncrier release notes start
2.0.1 (2023-04-14)
------------------
Internal:
- Update configuration files.
[plone devs] (93e1ab65)
2.0.0 (2023-03-21)
------------------
Breaking changes:
- pyupgrade, drop support for Python < 3.8.
isort, black, manual edits.
Fix deprecation warnings for imports from Products.CMFPlone.
Import and depend from plone.base. (#15)
1.3.3 (2020-09-07)
------------------
Bug fixes:
- Resolve deprecation warning [gforcada] (#14)
1.3.2 (2020-04-22)
------------------
Bug fixes:
- Minor packaging updates. (#1)
1.3.1 (2018-11-04)
------------------
Bug fixes:
- The ``Format`` accessor should actually return the ``format`` attribute
(see plone/Products.CMFPlone#2540)
[ale-rt]
1.3.0 (2018-09-28)
------------------
New features:
- Add support for Python 3.
[pbauer]
1.2.1 (2016-11-18)
------------------
New features:
- Removed ZopeTestCase. [maurits]
1.2 (2016-09-20)
----------------
New features:
- Provide a ContextWrapper adapter in order to easily pass custom messages
to StringInterpoator
[avoinea]
1.1.4 (2016-08-18)
------------------
Bug fixes:
- Use zope.interface decorator.
[gforcada]
1.1.3 (2016-05-25)
------------------
Fixes:
- Adapt to changes in SimpleViewClass in zope4.
[pbauer]
- Fix typo
[staeff]
1.1.2 (2015-03-13)
------------------
Fixes:
- Fixed "RuntimeError: maximum recursion depth exceeded" in
recursiveGetGroupUsers when you have a group A containing group B containing
group A.
[vincentfretin]
1.1.1 (2014-11-01)
------------------
- Add creator, creator_fullname, creator_email,
creators_emails and contributors_emails
[avoinea]
1.1 (2014-02-25)
----------------
- Add portal_url and portal_title.
[thomasdesvenain]
- Add parent_id.
[maartenkling]
- Convert tests to plone.app.testing for Plone 5.
[davisagli]
1.0.10 (2013-05-30)
-------------------
- Added review_state_title substitution variable.
[ichim-david]
1.0.9 (2013-05-26)
------------------
- Added id substitution variable
that works with content events and user events.
[thomasdesvenain]
- Email substitutions are not restricted to contentish anymore,
so we can use them with user events.
[thomasdesvenain]
1.0.8 (2013-05-23)
------------------
- Added editor_emails substitution variable.
[thomasdesvenain]
1.0.7 (2012-08-11)
------------------
- Added parent_title substitution, which gets the title of the container.
[thomasdesvenain]
- Fixed user_fullname substitution : display user id if fullname is not set.
[thomasdesvenain]
- Do not restrict string interpolation to IContentish if not necessary.
Fixes email content rule related with plone.app.discussion comments.
Refs https://dev.plone.org/ticket/13047
[thomasdesvenain]
1.0.6 (2012-08-04)
------------------
- Added parent_url substitution (the url of the object parent).
[thomasdesvenain]
1.0.5 (2012-01-26)
------------------
- Recursive get members works in a non wrapped context
(when getting PloneGroups instead of GroupData from GroupTool)
[thomasdesvenain]
- Add MANIFEST.in
[WouterVH]
1.0.4 - 2011-04-01
------------------
- Added contributor_emails and reader_emails substitution variables.
[thomasdesvenain]
1.0.3 - 2010-11-11
------------------
- Fix a bug with member email substitutions when a user has been
removed from acl_users.
[rossp]
1.0.2 - 2010-09-20
------------------
- Role email substitution works with user that have role through a group.
[thomasdesvenain]
1.0.1 - 2010-09-15
------------------
- Internationalized ${type} substitution.
[thomasdesvenain]
- Fixed: get emails for role works with local roles.
[thomasdesvenain]
1.0 - 2010-07-18
----------------
- Update license to GPL version 2 only.
[hannosch]
1.0b1 - 2009-11-12
------------------
- Initial release.
Raw data
{
"_id": null,
"home_page": "https://github.com/plone/plone.stringinterp",
"name": "plone.stringinterp",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "Plone Zope Interpolation",
"author": "Plone Foundation",
"author_email": "plone-developers@lists.sourceforge.net",
"download_url": "https://files.pythonhosted.org/packages/08/0a/07509cc874c43dc1c828ab2859a77aea00dc8e3bb102230736a5db2cc7e4/plone.stringinterp-2.0.1.tar.gz",
"platform": null,
"description": "Provides ``${id}`` style string interpolation using named adapters to look up variables.\nThis is meant to provide a trivially simple template system for clients like plone.app.contentrules.\n\nTo interpolate a string in context, just follow the pattern::\n\n from plone.stringinterp.interfaces import IStringInterpolator\n\n IStringInterpolator(context)(\"Here is the title: ${title}\")\n\nSubstitution of variables that are part of the Dublin Core are provided with the package.\nTo provide additional substitutions, provide a named adapter implementing ``interfaces.IStringSubstitution`` for your context.\nThe adapter name is used for the lookup.\n\nYou can also wrap your context with ``IContextWrapper`` adapter if you need to pass custom messages within your substitutions.\n\n\nImplemented Substitutions\n=========================\n\nAll Content\n-----------\n\n- id\n- parent_id\n- url\n- parent_url\n\n\nMinimal Dublin Core\n-------------------\n\n- title\n- description\n- type (content type)\n\nWorkflow Aware\n--------------\n\n- review_state\n- review_state_title\n\nDublin Core\n-----------\n- creator\n- creator_fullname\n- creator_email\n- creators\n- creators_emails\n- contributors\n- contributors_emails\n- subject\n- format (mime type)\n- language\n- rights\n- identifier\n\nCatalogable Dublin Core\n-----------------------\n\nEverything should be in long local time format\n\n- created\n- effective\n- expires\n- modified\n\nMember / Group Information for roles on content\n-----------------------------------------------\n\n- owner_emails\n- reviewer_emails\n- manager_emails\n- member_emails\n- user_email\n\nCurrent User Information\n------------------------\n\n- user_fullname\n- user_id\n\nLast Change (workflow or version) Information\n---------------------------------------------\n\n- change_comment\n- change_title\n- change_type\n- change_authorid\n\n\nSource Code\n===========\n\nContributors please read the document `Process for Plone core's development <https://docs.plone.org/develop/coredev/docs/index.html>`_\n\nSources and issue tracker are at the `Plone code repository hosted at Github <https://github.com/plone/plone.stringinterp>`_.\n\nChangelog\n=========\n\n.. You should *NOT* be adding new change log entries to this file.\n You should create a file in the news directory instead.\n For helpful instructions, please see:\n https://github.com/plone/plone.releaser/blob/master/ADD-A-NEWS-ITEM.rst\n\n.. towncrier release notes start\n\n2.0.1 (2023-04-14)\n------------------\n\nInternal:\n\n\n- Update configuration files.\n [plone devs] (93e1ab65)\n\n\n2.0.0 (2023-03-21)\n------------------\n\nBreaking changes:\n\n\n- pyupgrade, drop support for Python < 3.8.\n isort, black, manual edits.\n Fix deprecation warnings for imports from Products.CMFPlone.\n Import and depend from plone.base. (#15)\n\n\n1.3.3 (2020-09-07)\n------------------\n\nBug fixes:\n\n\n- Resolve deprecation warning [gforcada] (#14)\n\n\n1.3.2 (2020-04-22)\n------------------\n\nBug fixes:\n\n\n- Minor packaging updates. (#1)\n\n\n1.3.1 (2018-11-04)\n------------------\n\nBug fixes:\n\n- The ``Format`` accessor should actually return the ``format`` attribute\n (see plone/Products.CMFPlone#2540)\n [ale-rt]\n\n\n1.3.0 (2018-09-28)\n------------------\n\nNew features:\n\n- Add support for Python 3.\n [pbauer]\n\n\n1.2.1 (2016-11-18)\n------------------\n\nNew features:\n\n- Removed ZopeTestCase. [maurits]\n\n\n1.2 (2016-09-20)\n----------------\n\nNew features:\n\n- Provide a ContextWrapper adapter in order to easily pass custom messages\n to StringInterpoator\n [avoinea]\n\n\n1.1.4 (2016-08-18)\n------------------\n\nBug fixes:\n\n- Use zope.interface decorator.\n [gforcada]\n\n\n1.1.3 (2016-05-25)\n------------------\n\nFixes:\n\n- Adapt to changes in SimpleViewClass in zope4.\n [pbauer]\n\n- Fix typo\n [staeff]\n\n1.1.2 (2015-03-13)\n------------------\n\nFixes:\n\n- Fixed \"RuntimeError: maximum recursion depth exceeded\" in\n recursiveGetGroupUsers when you have a group A containing group B containing\n group A.\n [vincentfretin]\n\n\n1.1.1 (2014-11-01)\n------------------\n\n- Add creator, creator_fullname, creator_email,\n creators_emails and contributors_emails\n [avoinea]\n\n\n1.1 (2014-02-25)\n----------------\n\n- Add portal_url and portal_title.\n [thomasdesvenain]\n\n- Add parent_id.\n [maartenkling]\n\n- Convert tests to plone.app.testing for Plone 5.\n [davisagli]\n\n\n1.0.10 (2013-05-30)\n-------------------\n\n- Added review_state_title substitution variable.\n [ichim-david]\n\n\n1.0.9 (2013-05-26)\n------------------\n\n- Added id substitution variable\n that works with content events and user events.\n [thomasdesvenain]\n\n- Email substitutions are not restricted to contentish anymore,\n so we can use them with user events.\n [thomasdesvenain]\n\n\n1.0.8 (2013-05-23)\n------------------\n\n- Added editor_emails substitution variable.\n [thomasdesvenain]\n\n\n1.0.7 (2012-08-11)\n------------------\n\n- Added parent_title substitution, which gets the title of the container.\n [thomasdesvenain]\n\n- Fixed user_fullname substitution : display user id if fullname is not set.\n [thomasdesvenain]\n\n- Do not restrict string interpolation to IContentish if not necessary.\n Fixes email content rule related with plone.app.discussion comments.\n Refs https://dev.plone.org/ticket/13047\n [thomasdesvenain]\n\n\n1.0.6 (2012-08-04)\n------------------\n\n- Added parent_url substitution (the url of the object parent).\n [thomasdesvenain]\n\n\n1.0.5 (2012-01-26)\n------------------\n\n- Recursive get members works in a non wrapped context\n (when getting PloneGroups instead of GroupData from GroupTool)\n [thomasdesvenain]\n\n- Add MANIFEST.in\n [WouterVH]\n\n\n1.0.4 - 2011-04-01\n------------------\n\n- Added contributor_emails and reader_emails substitution variables.\n [thomasdesvenain]\n\n\n1.0.3 - 2010-11-11\n------------------\n\n- Fix a bug with member email substitutions when a user has been\n removed from acl_users.\n [rossp]\n\n\n1.0.2 - 2010-09-20\n------------------\n\n- Role email substitution works with user that have role through a group.\n [thomasdesvenain]\n\n\n1.0.1 - 2010-09-15\n------------------\n\n- Internationalized ${type} substitution.\n [thomasdesvenain]\n\n- Fixed: get emails for role works with local roles.\n [thomasdesvenain]\n\n\n1.0 - 2010-07-18\n----------------\n\n- Update license to GPL version 2 only.\n [hannosch]\n\n\n1.0b1 - 2009-11-12\n------------------\n\n- Initial release.\n",
"bugtrack_url": null,
"license": "GPL version 2",
"summary": "Adaptable string interpolation",
"version": "2.0.1",
"split_keywords": [
"plone",
"zope",
"interpolation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "37aded840788717f107b350a2d0617160c715a0556c9e60ff33a577b99d29d70",
"md5": "ca75e50a39d9facf9bd35688141cd880",
"sha256": "bcf79447be343fb7a5b6c90368ef0bcc03c86f4b58a8c9df4d121f904cbd1506"
},
"downloads": -1,
"filename": "plone.stringinterp-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ca75e50a39d9facf9bd35688141cd880",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 23396,
"upload_time": "2023-04-13T23:10:41",
"upload_time_iso_8601": "2023-04-13T23:10:41.886716Z",
"url": "https://files.pythonhosted.org/packages/37/ad/ed840788717f107b350a2d0617160c715a0556c9e60ff33a577b99d29d70/plone.stringinterp-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "080a07509cc874c43dc1c828ab2859a77aea00dc8e3bb102230736a5db2cc7e4",
"md5": "72dd14b9df155c8c630f00aae71f17f7",
"sha256": "ce9f0df90e69ccbb1ae5e58c40081aa95d851e26da221e227e3b5ad6cd410be2"
},
"downloads": -1,
"filename": "plone.stringinterp-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "72dd14b9df155c8c630f00aae71f17f7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 24240,
"upload_time": "2023-04-13T23:10:43",
"upload_time_iso_8601": "2023-04-13T23:10:43.961198Z",
"url": "https://files.pythonhosted.org/packages/08/0a/07509cc874c43dc1c828ab2859a77aea00dc8e3bb102230736a5db2cc7e4/plone.stringinterp-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-13 23:10:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "plone",
"github_project": "plone.stringinterp",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "plone.stringinterp"
}