Adding transitive filtering to roundup-admin (Ralf FYI)
"John P. Rouillard" <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all:
I tried to handle:
https://issues.roundup-tracker.org/issue2550522
which was a request to handle this case with roundup-admin:
roundup-admin -i . filter issue assignedto.username=Admin
I discovered that specifying:
assignedto.username=NoSuchUser
resulted in listing all of the issues in the database. I tracked this
down to code in hyperdb.py:Proptree::search that reads:
elif isinstance(p.val, type([])):
exact = []
subst = []
for v in p.val:
if isinstance(v, Exact_Match):
exact.append(v.value)
else:
subst.append(v)
if exact:
exact_match_spec[p.name] = exact
if subst:
filterspec[p.name] = subst
if subst is [] because nothing was found on the substring search of
the username prop, the filterspec is empty. This bubbles up to the
search across issues and returns all issues. I "fixed" it by changing
the last if clause to:
if subst:
filterspec[p.name] = subst
elif not exact: # don't set if we have exact criteria
filterspec[p.name] =[ '-1' ] # no match was found
So if exact matching is null we set up a filter spec will filter out
everything. If exact match is non-null we use it. This isn't quite
right.
I think what is needed is:
1) if there is a subst(ring) search defined,
then we set -1 as the value (as above).
2) if there is no substring search we do nothing.
however I don't know the code well enough to figure out #2.
This code was introduced in ee2e8f8d6648 to add the exact string match
functionality.
I have this passing the tests sqlite and anydbm. But I have a feeling
the backends may need some additional work. I'll see what CI says with
postgres and mysql.
Ralf any pointers here? My changes are in: 95183d73ac64
Have a great day all.
--
-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.