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

Python func for filtering (needtables and co) #132

Closed
danwos opened this issue Feb 10, 2020 · 1 comment
Closed

Python func for filtering (needtables and co) #132

danwos opened this issue Feb 10, 2020 · 1 comment
Assignees
Milestone

Comments

@danwos
Copy link
Member

danwos commented Feb 10, 2020

The content area of needfilter and co shall be used for defining a user-defined function for the search.

This function must return a list of needs.
As argument only needs and app/env shall be provided.

If content is defined no other filter options are allowed (exception raised)

example:

.. needtable::
   :columns: id, title, status

   results = []
   for need in needs:
       if need['status]` == "open":
          for spec in need['spec_links']:
             if spec['status'] == 'open':
              results.append(need)
              continue

    return results

This functions gets executed only once per needtable.
Instead of a filter_string, which gets executed once per need.

So it should be much faster compared to filter_strings with list comprehensions (if the user does not define too fancy stuff).

@danwos danwos added this to the 0.5.3 milestone Feb 10, 2020
@danwos danwos self-assigned this Feb 10, 2020
@ubmarco
Copy link
Member

ubmarco commented Feb 10, 2020

I'd appreciate this feature, should bring a lot of flexibility to the user while avoiding confusing filter_strings for complex searches/filters.

@danwos danwos closed this as completed in 462a174 Feb 11, 2020
@danwos danwos reopened this Feb 11, 2020
@danwos danwos closed this as completed in 23c285e Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants