PlaidWeb / Publ

Flexible publishing system for the web
http://publ.beesbuzz.biz/
MIT License
40 stars 4 forks source link

Provide concatenation thingy for view.entries #568

Open fluffy-critter opened 6 months ago

fluffy-critter commented 6 months ago

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.