Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
RcColes committed Oct 2, 2018
2 parents 3d75769 + e3a83ac commit f9c6f2f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ matrix:
env: BUILD=pytz201702
- python: 3.6
env: BUILD=pytz_latest
- python: 3.6
env: BUILD=dateutil26
- python: 3.6
env: BUILD=dateutil_latest
- python: 3.7
dist: xenial
sudo: true
Expand Down
8 changes: 1 addition & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ You want to contribute to *khal*? Awesome!

The most appreciated way of contributing is by supplying code or documentation,
reporting bugs, creating packages for your favorite operating system, making
khal better known by telling your friends about it, etc. If you don't have
the time or the means to contribute in any of the above mentioned ways,
donations are appreciated, too.

.. image:: https://api.flattr.com/button/flattr-badge-large.png
:alt: flattr button
:target: http://flattr.com/thing/2475065/geierkhal-on-GitHub/
khal better known by telling your friends about it, etc.

License
-------
Expand Down
22 changes: 17 additions & 5 deletions khal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,23 @@ def sanitize_datetime(date):
dtstart = vevent['DTSTART'].dt
if events_tz:
dtstart = dtstart.replace(tzinfo=None)
if events_tz and 'Z' not in rrule_param.to_ical().decode():
logger.warning(
"In event {}, DTSTART has a timezone, but UNTIL does not. This "
"might lead to errenous repeating instances (like missing the "
"last intended instance or adding an extra one)."
"".format(href))
elif not events_tz and 'Z' in rrule_param.to_ical().decode():
logger.warning(
"In event {}, DTSTART has no timezone, but UNTIL has one. This "
"might lead to errenous repeating instances (like missing the "
"last intended instance or adding an extra one)."
"".format(href))

rrule = dateutil.rrule.rrulestr(
rrule_param.to_ical().decode(),
dtstart=dtstart
dtstart=dtstart,
ignoretz=True,
)

if rrule._until is None:
Expand All @@ -334,10 +347,9 @@ def sanitize_datetime(date):
# if python can deal with larger datetime values yet and b) pytz
# doesn't know any larger transition times
rrule._until = dt.datetime(2037, 12, 31)
elif getattr(rrule._until, 'tzinfo', None):
rrule._until = rrule._until \
.astimezone(events_tz) \
.replace(tzinfo=None)
elif events_tz and 'Z' in rrule_param.to_ical().decode():
rrule._until = pytz.UTC.localize(
rrule._until).astimezone(events_tz).replace(tzinfo=None)

rrule = map(sanitize_datetime, rrule)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'urwid',
'pyxdg',
'pytz',
'python-dateutil<=2.6.1',
'python-dateutil',
'configobj',
# https://github.com/untitaker/python-atomicwrites/commit/4d12f23227b6a944ab1d99c507a69fdbc7c9ed6d # noqa
'atomicwrites>=0.1.7',
Expand Down
2 changes: 2 additions & 0 deletions tests/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ def test_printformats(runner):
assert not result.exception


# "see #810"
@pytest.mark.xfail
def test_repeating(runner):
runner = runner(days=2)
now = dt.datetime.now().strftime('%d.%m.%Y')
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = {py34,py35,py36}-{tests,style,mypy}-{pytz201702,pytz201610,pytz_latest}
envlist = {py34,py35,py36}-{tests,style,mypy}-{pytz201702,pytz201610,pytz_latest}-{dateutil26,dateutil_latest}
skip_missing_interpreters = True

[testenv]
Expand All @@ -22,6 +22,8 @@ deps =
pytz201610: pytz==2016.10
pytz_latest: pytz
py34: typing
dateutil26: python-dateutil<2.7
dateutil_latest: python-dateutil

commands =
py.test {posargs}
Expand Down

0 comments on commit f9c6f2f

Please sign in to comment.