| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@pganssle I think I've addressed the feedback you added to: ryanpetrello@a9007c4#commitcomment-28049100 |
Sorry, something went wrong.
| self._until = until | ||
|
|
||
| if self._dtstart and self._until: | ||
| if all(( |
There was a problem hiding this comment.
I think this might be better as:
if (self._dtstart.tzinfo is not None) != (self._until.tzinfo is not None)
That's basically the condition under which it would fail because of the comparison anyway, and I don't want to enforce that it's specifically tzutc (what if you used datetime.timezone.utc or pytz.UTC). I think being slightly less strict about the specifics of the RFC is worth it in this case, since I want to tread lightly.
I'll note that there's a very strange edge case that would occur if self._dtstart.tzinfo is self._until.tzinfo and the UNTIL value is an ambiguous time, but I'm not terribly worried about that.
Sorry, something went wrong.
There was a problem hiding this comment.
Oh, and one thing to note is that my formulation also catches the case where only UNTIL is aware.
Sorry, something went wrong.
There was a problem hiding this comment.
Good point - addressed 👍
Sorry, something went wrong.
related: dateutil#620 related: dateutil#633
| until = datetime.datetime.fromordinal(until.toordinal()) | ||
| self._until = until | ||
|
|
||
| if self._dtstart and self._until: |
There was a problem hiding this comment.
There's no need for this line. The problem is with the incompatibility between DTSTART and UNTIL. Not sure what the RFC has to say, but if UNTIL is aware and DTSTART has no specified time zone, you still don't know when to end the rule.
Sorry, something went wrong.
There was a problem hiding this comment.
@pganssle it seems necessary to me. If I change this and run the tests:
> if (self._dtstart.tzinfo is not None) != (self._until.tzinfo is not None):
E AttributeError: 'NoneType' object has no attribute 'tzinfo'
Sorry, something went wrong.
There was a problem hiding this comment.
...or at the very least, we need to check truthiness of self._until.
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, you are right, sorry, I read this as self._dstart.tzinfo, my bad.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
related: #620
related: #633