(self, **kwargs)
| 969 | self._update_rrule(**self._construct) |
| 970 | |
| 971 | def _update_rrule(self, **kwargs): |
| 972 | tzinfo = self._base_tzinfo |
| 973 | |
| 974 | # rrule does not play nicely with timezones - especially pytz time |
| 975 | # zones, it's best to use naive zones and attach timezones once the |
| 976 | # datetimes are returned |
| 977 | if 'dtstart' in kwargs: |
| 978 | dtstart = kwargs['dtstart'] |
| 979 | if dtstart.tzinfo is not None: |
| 980 | if tzinfo is None: |
| 981 | tzinfo = dtstart.tzinfo |
| 982 | else: |
| 983 | dtstart = dtstart.astimezone(tzinfo) |
| 984 | |
| 985 | kwargs['dtstart'] = dtstart.replace(tzinfo=None) |
| 986 | |
| 987 | if 'until' in kwargs: |
| 988 | until = kwargs['until'] |
| 989 | if until.tzinfo is not None: |
| 990 | if tzinfo is not None: |
| 991 | until = until.astimezone(tzinfo) |
| 992 | else: |
| 993 | raise ValueError('until cannot be aware if dtstart ' |
| 994 | 'is naive and tzinfo is None') |
| 995 | |
| 996 | kwargs['until'] = until.replace(tzinfo=None) |
| 997 | |
| 998 | self._construct = kwargs.copy() |
| 999 | self._tzinfo = tzinfo |
| 1000 | self._rrule = rrule(**self._construct) |
| 1001 | |
| 1002 | def _attach_tzinfo(self, dt, tzinfo): |
| 1003 | # pytz zones are attached by "localizing" the datetime |
no test coverage detected