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

Fix broken links in RichTextValue.output transformations #17

Closed
wants to merge 2 commits into from

Conversation

thet
Copy link
Member

@thet thet commented Jul 16, 2015

Fix issue, where the RichTextValue.output was transforming relative to an ISite object. This broke relative links and for subsites also internal absolute links. Fixes: #7

Obsoletes branch: https://github.com/plone/plone.app.textfield/pull/thet-fix-issue7

@davisagli - Referring to the discussion in #7
Using output_relative_to isn't an option, as all templates are using just output. I don't really like the code for obtaining the context, but it was the only one I could come up with.

RFC, NOT READY TO MERGE!

No tests yet, as I want to discuss this issue first. I even have to reconstruct the testcases to provide examples, what was broken when. Wait for it.

…o an ISite object. This broke relative links and for subsites also internal absolute links. Fixes: #7
@thet
Copy link
Member Author

thet commented Dec 15, 2015

In plone.app.contenttypes I've seen code doing: <p tal:content="structure python:context.text.output_relative_to(view.context)"/> ( https://github.com/plone/plone.app.contenttypes/blob/master/plone/app/contenttypes/browser/templates/document.pt ) - which is awkward but the correct way.
Other code is using just output: ( https://github.com/plone/plone.app.contenttypes/blob/master/plone/app/contenttypes/browser/templates/newsitem.pt and other...).
I'd like to have this fixed for just calling textvalue/output, but my fix here is ugly because it relies on the existance of specific urls in the request var, needs traversing and does not work for indexing for example.
Maybe there is a better way to retrieve the current context?

It would be easier if we suggest people to use output_relative_to.

@pbauer any ideas on this?

thet added a commit to plone/plone.app.event that referenced this pull request Dec 20, 2015
…urrent context. This correctly transforms relative links. See: plone/plone.app.textfield#17
thet added a commit to plone/buildout.coredev that referenced this pull request Dec 20, 2015
Branch: refs/heads/master
Date: 2015-12-21T00:59:29+01:00
Author: Johannes Raggam (thet) <thetetet@gmail.com>
Commit: plone/plone.app.event@ed5b5d4

Change the behaviors text getter to use output_relative_to with the current context. This correctly transforms relative links. See: plone/plone.app.textfield#17

Files changed:
M CHANGES.rst
M plone/app/event/dx/behaviors.py
@jensens
Copy link
Sponsor Member

jensens commented Feb 2, 2016

whats the state here?

@thet
Copy link
Member Author

thet commented Feb 2, 2016

Have to close this. The RichTextValue cannot access its context, so the RichTextValue's output method has to get passed the correct context:
Like: <p tal:content="structure python:context.text.output_relative_to(view.context)"/> ( https://github.com/plone/plone.app.contenttypes/blob/master/plone/app/contenttypes/browser/templates/document.pt )

@thet thet closed this Feb 2, 2016
@thet thet deleted the thet-better-fix-issue7 branch February 2, 2016 23:05
thet added a commit to collective/collective.venue that referenced this pull request Feb 4, 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.

Relative links are interpreted relative to Site Root, not the content object
2 participants