On Mon, Jan 25, 2016 at 10:42:55AM +0100, Petter Reinholdtsen wrote: > [Guido Günther] > > Wouldn't it be simpler to exercise match_filter_element() directly > > (introducing a new unit test class TestMatchFIlterElement). You'd then > > have tight control on the input data and the matching rules. The > > necessary data could be dumped out of match_filter_element() with the > > unpatched code. > > Yes, this was simpler. Using match_filter() I got a working test. In > the process I discovered that the test probably worked earlier too, as > the query was for VTODO items while the test set had VCALENDAR an item. > Anyway, attached are two patches to fix the handling of <time-range>. > The first is just making the type of a return value more consistent, > while the second actually fixes the issue. > > -- > Happy hacking > Petter Reinholdtsen
> From eb2beaaecd430273133ef21bcf81eaf647fd4041 Mon Sep 17 00:00:00 2001 > From: Petter Reinholdtsen <[email protected]> > Date: Mon, 25 Jan 2016 09:30:19 +0000 > Subject: [PATCH 1/2] Make sure match_filter() return True or False, not True > or None. > > This make the return consistenly a boolean, and make printing the > result prettier. > --- > calypso/xmlutils.py | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/calypso/xmlutils.py b/calypso/xmlutils.py > index e94a5e9..67290b7 100644 > --- a/calypso/xmlutils.py > +++ b/calypso/xmlutils.py > @@ -313,6 +313,7 @@ def match_filter(item, filter): > for fe in filter.getchildren(): > if match_filter_element(item.object, fe): > return True > + return False > > def report(path, xml_request, collection): > """Read and answer REPORT requests. Applied. Thanks! Would be good to send one patch per mail in the future to make this simpler. Cheers, -- Guido _______________________________________________ Calypso mailing list [email protected] http://keithp.com/mailman/listinfo/calypso
