Hi r2d2:
I answered on IRC, but I can condense/fix and copy it here. From IRC:
> so here is a link to the codeline https://codeberg.org/R2D2/roundup_todo_tracker_template/src/commit/e9eb1610830f8c188de1bfa0c6fbd8d560739d84/todo/html/issue.item.html#L79
>11:04.55 (EDT) - r2d2: i want to extend this with a second keyword field named project
>11:05.57 (EDT) - r2d2: is there a way to use something like an format-string within the filter='...' expression?
You can use printf formatting:
filter='status=waiting,in progress,needs attention;keyword=%s' %
context.keyword.plain()
it's just python at that point. I assume you are trying to find all
"waiting,in progress" status ... issues that match the
current context. Searching with mutlilinks is a bit tricky. What you
have I think will be an or search by default.
So if there were two keywords you would get any project that has either keyword.
You have to create a boolean expression if you have a multilink. If
you have two keywords you would filter using keyword1,keyword2,-3
which is an RPN/postfix expression and'ing (-3) the two keywords. See
the definition of filter in
roundup/hyperdb.py.
If you are going to be doing complex filtering, add a utility function
and do the work in the utility function. Trying to do any extensive
logic/python programming within the template is unreadable/subject to
quoting issues (as you kind of lose the " or need to escape it since
its used to delimit the tal expression.
See https://roundup-tracker.org/docs/customizing.html#adding-a-time-log-to-your-issues-4
for an example of registering a utility method.
-- rouilj
On Sun, Mar 10, 2024 at 1:49 PM <r2d2@mirakel.one> wrote:
>
> Hello Everyone,
>
> I struggle to understand a line in issue.item.html (based on the classic tracker template).
>
> I duplicated everything for keywords (renamed to projects), but the filter statement eludes me:
> - here is a link to the codeline https://codeberg.org/R2D2/roundup_todo_tracker_template/src/commit/e9eb1610830f8c188de1bfa0c6fbd8d560739d84/todo/html/issue.item.html#L79
> - I want to extend this with a second keyword field named project
> - Is there a way to use something like an format-string within the filter='...' expression?
>
>
> Thanks in advance!
>
>
> --
> Have a fine week!
>
> r2d2
>
>
> _______________________________________________
> Roundup-users mailing list
> Rou...@li...
> https://lists.sourceforge.net/lists/listinfo/roundup-users
|