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

unsolicited translation #328

Closed
d-maurer opened this issue Jul 22, 2020 · 1 comment
Closed

unsolicited translation #328

d-maurer opened this issue Jul 22, 2020 · 1 comment

Comments

@d-maurer
Copy link

Demonstrated by (under Python 3):

from chameleon.zpt.template import PageTemplate

def translate(*args, **kw): return "translated"

class ToConvertButNotToTranslate:
  def __init__(self, text): self.text = text
  def __str__(self): return self.text

x = ToConvertButNotToTranslate("x")

ts = """<div tal:content="x" />"""
t = PageTemplate(ts)
t(translate=translate, x=x)

This returns <div>translated</div>; it should return <div>x</div>.

@d-maurer
Copy link
Author

I see that the behavior is explicitly documented: "everything is translated which is not a string or a number and does not have __html__".

Thus, it is likely a feature (even though perhaps a strange one).

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

No branches or pull requests

1 participant