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

length filter should also handle objects #283

Closed
jlongster opened this issue Sep 23, 2014 · 3 comments
Closed

length filter should also handle objects #283

jlongster opened this issue Sep 23, 2014 · 3 comments
Labels

Comments

@jlongster
Copy link
Contributor

Make length return the number of a keys an object has.

@ricordisamoa
Copy link
Contributor

Right, that'd match Jinja2's behaviour given how JavaScript objects are often used as Python dictionaries. But what about objects with a length property? That'd be a breaking change...

@carljm
Copy link
Contributor

carljm commented Apr 5, 2016

It'd be a minor breaking change, but I still think it's the right thing to do. Marking this as a 3.0 change, since I don't want the breaking change in a 2.x release.

@carljm carljm added the 3.x label Apr 5, 2016
@carljm carljm modified the milestone: 3.0 Apr 5, 2016
@carljm carljm removed the 3.x label Apr 5, 2016
@carljm
Copy link
Contributor

carljm commented Jun 7, 2016

I don't think "object with length property" is really a reasonable thing for someone to be taking advantage of currently, so I'm going to consider this a bugfix rather than a breaking change.

@carljm carljm added bug and removed enhancement labels Jun 7, 2016
@carljm carljm removed this from the 3.0 milestone Jun 7, 2016
kevinschaul added a commit to kevinschaul/nunjucks that referenced this issue Aug 21, 2016

Verified

This commit was signed with the committer’s verified signature.
In length builtin filter. For objects, "length" is the number of keys
the object has.

Fixes mozilla#283
kevinschaul added a commit to kevinschaul/nunjucks that referenced this issue Aug 21, 2016
In length builtin filter. For objects, "length" is the number of keys
the object has.

Fixes mozilla#283
carljm pushed a commit that referenced this issue Aug 30, 2016
* Add support for finding object length

In length builtin filter. For objects, "length" is the number of keys
the object has.

Fixes #283

* Add link to relevant pull request
carljm pushed a commit that referenced this issue Aug 30, 2016
* Add support for finding object length

In length builtin filter. For objects, "length" is the number of keys
the object has.

Fixes #283

* Add link to relevant pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants