GithubHelp home page GithubHelp logo

Comments (8)

dnouri avatar dnouri commented on May 27, 2024

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.

malthe avatar malthe commented on May 27, 2024

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.

dnouri avatar dnouri commented on May 27, 2024

Are you sure that checked="${cond}" will drop the attribute if it's False? It only seems to work with None.

from chameleon.

malthe avatar malthe commented on May 27, 2024

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.

malthe avatar malthe commented on May 27, 2024

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.

dnouri avatar dnouri commented on May 27, 2024

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.

malthe avatar malthe commented on May 27, 2024

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.

dnouri avatar dnouri commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.