Skip to content

fix(rrule): clearer rrulestr error for datetimes written with colons - #1634

Open
Enesuygurs wants to merge 2 commits into
dateutil:masterfrom
Enesuygurs:fix/960-rrulestr-stray-colon-error
Open

Enesuygurs wants to merge 2 commits into
dateutil:masterfrom
Enesuygurs:fix/960-rrulestr-stray-colon-error

Conversation

@Enesuygurs

Copy link
Copy Markdown

Summary of changes

rrulestr("FREQ=YEARLY;WKST=MO;UNTIL=2019-03-29T00:59:59+01:00") raises ValueError: unsupported property: FREQ=YEARLY, which points at the wrong thing. Because the string contains a colon, _parse_rfc splits the line on the colon inside the UNTIL time and treats FREQ=YEARLY as a property name.

When the text before the first colon is not a valid RFC 5545 property name ([A-Z0-9-]+), the error now shows the whole line and explains that datetimes must be written without delimiters (e.g. 20190329T005959). Valid but unsupported names such as X-ABC-MMSUBJ keep the existing unsupported property: X-ABC-MMSUBJ message.

The message and tests are the ones @pganssle suggested in the review of #1069, which was closed without being merged.

Fixes #960

Pull Request Checklist

  • Changes have tests
  • Authors have been added to AUTHORS.md
  • News fragment added in changelog.d. See CONTRIBUTING.md for details

rrulestr("FREQ=YEARLY;UNTIL=2019-03-29T00:59:59") split the line on the
colon inside the UNTIL value and reported "unsupported property:
FREQ=YEARLY". When the part before the first colon is not a valid
property name, raise an error that shows the whole line and explains
that RFC 5545 datetimes must not contain delimiters. Valid but
unsupported property names keep the existing message.

Fixes dateutil#960

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unsupported property: FREQ=YEARLY

1 participant