Skip to main content

Adaptable string interpolation

Project description

Introduction

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 subsitutions, just provide a named adapter implementing interfaces.IStringSubstitution for your context. The adapter name is used for the lookup.

Dependencies

Dependencies are all in the CMF* namespace, so this theoretically useful outside Plone. It does use the ‘plone’ identifier for the message factory.

Implemented Substitutions

All Content

url

Minimal Dublin Core

title description type (content type)

Workflow Aware

review_state

Dublin Core

creators contributors 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

Changelog

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plone.stringinterp-1.0.5.tar.gz (17.0 kB view details)

Uploaded Source

File details

Details for the file plone.stringinterp-1.0.5.tar.gz.

File metadata

File hashes

Hashes for plone.stringinterp-1.0.5.tar.gz
Algorithm Hash digest
SHA256 29555fbbcafea6e0f0fc29454c6463daad1a3777bbac2f91b04d338649278677
MD5 a60848a07b35c14639ca6aa0d9c4d66b
BLAKE2b-256 80901604d58643c7e4cd2e05ae3023ac9ed358f49da07ccf61a663cda121ba89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page