# HG changeset patch # User Paul Boddie # Date 1511539776 -3600 # Node ID 3b7c6541fb43881d34be7e5d797f588be3b546b1 # Parent 7e316a669ac2c24f92c5ffd42be789e72126b47e Allow BY... qualifiers to coexist with frequency qualifiers at the same resolution, even though such combinations may not make sense. diff -r 7e316a669ac2 -r 3b7c6541fb43 vRecurrence.py --- a/vRecurrence.py Tue Oct 24 01:05:08 2017 +0200 +++ b/vRecurrence.py Fri Nov 24 17:09:36 2017 +0100 @@ -62,8 +62,8 @@ "YEARLY", "MONTHLY", "WEEKLY", - None, - None, + None, # yearday has no equivalent frequency + None, # monthday has no equivalent frequency "DAILY", "HOURLY", "MINUTELY", @@ -278,8 +278,11 @@ l.append(LimitSelector(0, count, "COUNT")) # Make BYSETPOS sort earlier than the enumeration it modifies. + # Other BY... qualifiers sort earlier than selectors at the same resolution + # even though such things as "FREQ=HOURLY;BYHOUR=10" do not make much sense. - l.sort(key=lambda x: (x.level, x.qualifier != "BYSETPOS" and 1 or 0)) + l.sort(key=lambda x: (x.level, not x.qualifier.startswith("BY") and 2 or + x.qualifier != "BYSETPOS" and 1 or 0)) return l def get_datetime_structure(datetime):