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

Provide concatenation thingy for view.entries #568

Open
fluffy-critter opened this issue May 21, 2024 · 0 comments
Open

Provide concatenation thingy for view.entries #568

fluffy-critter opened this issue May 21, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@fluffy-critter
Copy link
Collaborator

Expected Behavior

{% for entry in view(entry_type='sticky',date=None).entries + view(entry_type_not='sticky') %}

would provide an iterator that allows you to consume the entries serially from the two stated viewspecs.

Current Behavior

The entry list needs to be coerced into a list using the |list operator, e.g.

An error because of the CallableProxy raises, and you have to explicitly call the entries function:

        {%- for entry in view(entry_type='sticky',date=None).entries()+ view(entry_type_not='sticky').entries() -%}

Possible Solution

CallableProxy could get an __add__ function that simply calls self() + rhs(), although then extra care needs to be taken to allow further chaining, so maybe something like:

def add(self, rhs):
    return CallableProxy(lambda:self() + rhs())

would work.

@fluffy-critter fluffy-critter added the enhancement New feature or request label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant