Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IContextWrapper adapter #9

Merged
merged 5 commits into from Sep 20, 2016
Merged

IContextWrapper adapter #9

merged 5 commits into from Sep 20, 2016

Conversation

avoinea
Copy link
Sponsor Member

@avoinea avoinea commented Aug 29, 2016

The current way of passing custom messages to IStringSubstituion is via context.REQUEST or by using session_data_manager which is also based on the special object on context called REQUEST.

Unfortunately, this approach doesn't work in all cases, one of it is plone.app.async where the REQUEST object is stripped from context in order not to pollute the zc.async queue.

This PR provides a custom adapter IContextWrapper that can be used to store custom messages without polluting the context or the REQUEST and still preserve the already defined context's string substitutions.

Note that this adapter is not used by default, it can be used on demand like:

>>> wrapper = IContextWrapper(context)(message="My cool message")
>>> zope.event.notify(CustomContentRuleEvent(wrapper))

@jensens
Copy link
Sponsor Member

jensens commented Aug 29, 2016

You can always start a Jenkins test-job on your own to test that your pull request (PR) does not break anything.

Below click on the link to Jenkins
screenshot from 2016-07-25 11 20 06

log in with your Github user - if not already done before.

Paste the full pull request URL into the text field (if multiple pull requests need to be combined in one run, then one PR URL per line)

Click on Build

Jenkins reports back to the pull request(s) on Github in the status box at the bottom.

In Plone we value a lot our testing suite, so we usually never merge pull requests if they have not been tested by Jenkins first.

@avoinea
Copy link
Sponsor Member Author

avoinea commented Aug 29, 2016

I don't think the failed job has something to do with this PR

@jensens jensens merged commit 69b131a into plone:master Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants