Git Product home page Git Product logo

Comments (2)

ged-odoo avatar ged-odoo commented on July 26, 2024

This is because Owl evaluates expressions as javascript (with some additional allowed words, see https://github.com/odoo/owl/blob/master/doc/reference/templates.md#expression-evaluation). So, we allow the use of and, or, gte, lte, gt, lt.

Since not is not part of the spec (as far as I know), it has not been translated into !, which is why your code fails. So:

  • we can update the spec and add it to the list of keywords that are replaced
  • just not do anything.

I am not completely comfortable with increasing the distance between the expression in the template and the corresponding javascript expression, so I think that in this case, the correct decision is to just keep owl as it is.

from owl.

sdegueldre avatar sdegueldre commented on July 26, 2024

I agree with Géry. The reason the other ones are supported is to avoid having to use encoded XML entities in the middle of expressions as it greatly reduces legibility, in particular & and < need to be encoded in attributes, which is why we have to allow for alternate forms of &&, < and <=. The rest exist for consistency/symmetry of comparisons even though they're not stricly needed. The purpose here is not to allow python syntax in expressions, in fact none of the comparisons are valid python anyway, but I can understand why one might think that. We should probably clarify the docs on that front. We could even enable a warning at compilation time in dev mode, since not is probably not a common variable name.

from owl.

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.