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

RichTextValue.output always uses siteroot #24

Open
jaroel opened this issue Sep 29, 2017 · 2 comments
Open

RichTextValue.output always uses siteroot #24

jaroel opened this issue Sep 29, 2017 · 2 comments

Comments

@jaroel
Copy link
Member

jaroel commented Sep 29, 2017

RichTextValue.output always uses the siteroot for rendering (via output_relative_to).
This means that the ITransform adapter is not called for the correct context.

The default display template already uses context.text.output_relative_to(view.context), so maybe .output should be removed?

@thet
Copy link
Member

thet commented Oct 5, 2017

I'd prefer to keep output but make it context aware and deprecate output_relative_to. AFAICT, the richtextvalue doesn't have access to the context where it's used. So, when keeping output we need to pass the context (maybe with the siteroot as default). This would be quite a breaking change unless we go for another name, like text and deprecate output too.
Maybe we should also add a __call__ method, which returns the output,which would solve: #25

I once tried to obtain the correct context from the global request, but I guess that's not the way to go: #17

In any case, the distinction btw output and output_relative_to often leads to confusion - I already spend a good amount of time with that.

/cc'ing @davisagli because he knows this package quite well.

@jaroel
Copy link
Member Author

jaroel commented Nov 8, 2017

We can get the context by walking the frame stack.
I've added an implementation of that to the PR for plone.restapi.
Maybe we should use that here instead of plone.restapi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants