Comments (8)
Hmm, what is possible however is this:
<input type="checkbox"
name="foo"
checked="${cond and 'checked' or None}" />
I guess this does have to do with the recently removed "boolean attributes" feature after all. Close?
from chameleon.
It should definitely work.
What might happen is that your cond
is simply a false value. That
drops the attribute (which is different than what you get in
zope.pagetemplate). In addition, a value of None
also drops the
attribute, but that's probably expected.
On 5 September 2011 13:17, dnouri
[email protected]
wrote:
Something that used to work in Chameleon 1 was:
<input type="checkbox"
name="foo"
checked="${cond and 'checked'}" />I thought this inline feature was actually quite neat. What I need to do instead in Chameleon 2 is:
<input type="checkbox"
name="foo"
tal:attributes="checked cond and 'checked'" />Is this a bug?
Reply to this email directly or view it on GitHub:
#48
from chameleon.
Are you sure that checked="${cond}" will drop the attribute if it's False? It only seems to work with None.
from chameleon.
It will (should, according to the tests) in Chameleon, unless the literal_false
setting is given.
Note that in Zope (i.e. via z3c.pt
), this parameter is given.
from chameleon.
You're right.
It won't drop the attribute, but that's because the ${...}
operator always returns a string value. But perhaps the result should be an attribute with an empty string in it.
from chameleon.
On Wed, Sep 14, 2011 at 12:49 PM, Malthe Borch
[email protected]
wrote:
You're right.
It won't drop the attribute, but that's because the
${...}
operator always returns a string value. But perhaps the result should be an attribute with an empty string in it.
Aha. My point was also that it used to work in Chameleon 1. But don't
worry, I can live with it.
http://danielnouri.org
+49 151 28 12 89 66
from chameleon.
Can you take a look at the (updated) test that I just committed. Doesn't this demonstrate (although slightly awkwardly) that it does work?
from chameleon.
It does. I'm surprised. This happened to me in the latest Kotti btw. I'll check again when I get around to it.
from chameleon.
Related Issues (20)
- SystemError AST constructor recursion depth mismatch error on Python 3.11 HOT 8
- Wheel releases? HOT 8
- sdist is missing tests HOT 1
- Chameleon support for Python 3.11? HOT 4
- i18n:target undefined variable HOT 2
- `target_language` not passed to the translate method in certain cases HOT 1
- Python f-strings with numbers give unexpected results
- Missing tag for 4.0.1 HOT 2
- 4.0.1: `chameleon` code is using deprecated `pkg_resources` module HOT 6
- Boolean HTML attribute behavior under >3.8.0 HOT 2
- 4.1.0 wheel doesn't work under Python 3.11 HOT 5
- RFE: is it possible to start making github releases?🤔 HOT 3
- SystemError: AST constructor recursion depth mismatch HOT 9
- dict-like Scope breaks locals() introspection HOT 2
- 4.3.0 release is breaking on Windows HOT 6
- Fix deprecated ast.Str (replace with ast.Constant)
- Tests are missing in 4.4.1 release HOT 4
- Automated release workflow
- 'PosixPath' object has no attribute 'at' HOT 3
- Type annotations HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chameleon.