Skip to content

Commit

Permalink
Merge pull request #15 from plone/housecleaning
Browse files Browse the repository at this point in the history
upgrade to py3 and plone codestyle
  • Loading branch information
jensens authored Mar 15, 2023
2 parents 044e97b + b150888 commit a6f984e
Show file tree
Hide file tree
Showing 13 changed files with 637 additions and 694 deletions.
36 changes: 21 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
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.
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, just
provide a named adapter implementing interfaces.IStringSubstitution
for your context. The adapter name is used for the lookup.
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.
You can also wrap your context with ``IContextWrapper`` adapter if you need to pass custom messages within your substitutions.

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

Implemented Substitutions
=========================

All Content
-----------

- id
- parent_id
- url
Expand All @@ -36,12 +28,14 @@ All Content

Minimal Dublin Core
-------------------

- title
- description
- type (content type)

Workflow Aware
--------------

- review_state
- review_state_title

Expand All @@ -62,6 +56,7 @@ Dublin Core

Catalogable Dublin Core
-----------------------

Everything should be in long local time format

- created
Expand All @@ -71,6 +66,7 @@ Everything should be in long local time format

Member / Group Information for roles on content
-----------------------------------------------

- owner_emails
- reviewer_emails
- manager_emails
Expand All @@ -79,12 +75,22 @@ Member / Group Information for roles on content

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>`_.
5 changes: 5 additions & 0 deletions news/15.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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.

7 changes: 1 addition & 6 deletions plone/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
__import__("pkg_resources").declare_namespace(__name__)
3 changes: 0 additions & 3 deletions plone/stringinterp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
from .dollarReplace import Interpolator

from zope.i18nmessageid import MessageFactory
_ = MessageFactory('plone')
Loading

0 comments on commit a6f984e

Please sign in to comment.