# HG changeset patch # User Paul Boddie # Date 1511539776 -3600 # Node ID 66d50605afa5b738983cbc1ab41ac699905b2d49 # Parent f8b0f7f80731cf904bf61bccd844474ffeb0b903 Allow BY... qualifiers to coexist with frequency qualifiers at the same resolution, even though such combinations may not make sense. diff -r f8b0f7f80731 -r 66d50605afa5 vRecurrence.py --- a/vRecurrence.py Fri Nov 24 16:59:33 2017 +0100 +++ 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):