Skip to content

Enable timezone support and set timezone to UTC #4545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 6, 2018

Conversation

davidfischer
Copy link
Contributor

The two primary changes here are:

  • Change TIME_ZONE from America/Chicago to UTC.
  • Set USE_TZ to True (the default is False).

These are the defaults for new projects in Django.

Links

Notes

Our production database is already timezone aware so I don't believe this will cause issues with the production database. Django's docs say as much but it's worth a second look.

docs=> SELECT last_login, date_joined FROM auth_user WHERE username='xxx';
          last_login           |      date_joined
-------------------------------+------------------------
 2018-08-18 22:01:47.979033+00 | 2011-12-22 06:02:28+00
(1 row)

@davidfischer davidfischer added the PR: work in progress Pull request is not ready for full review label Aug 20, 2018
@humitos
Copy link
Member

humitos commented Aug 20, 2018

All your changes look correct to me. Although, I'm not 100% sure how to test other things or where we could find issues by changing these settings.

Maybe it's a good moment to upgrade pytz to 2018.05 (currenty 2018.04) together with these changes.

@davidfischer
Copy link
Contributor Author

Although, I'm not 100% sure how to test other things or where we could find issues by changing these settings.

That's what terrifies me as well.

@ericholscher
Copy link
Member

Sounds like it should be raising warnings in the console if we have issues, and I don't see any warnings in our tests. I'm guessing the primary issue is that we might end up with some dates in the future when we do the switch or something like that.

@davidfischer
Copy link
Contributor Author

davidfischer commented Aug 21, 2018

All the warnings that came from executing the test suite were fixed as part of this PR. I just suspect there might be some not covered by our tests.

Dates in the database should be ok.

@agjohnson agjohnson added this to the 2.8 milestone Aug 27, 2018
@ericholscher
Copy link
Member

I'm tempted to try and merge this in. If the DB is correct, then I think we'll be alright. Thoughts?

@ericholscher ericholscher requested a review from a team November 1, 2018 19:20
@codecov
Copy link

codecov bot commented Nov 1, 2018

Codecov Report

Merging #4545 into master will increase coverage by <.01%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master    #4545      +/-   ##
==========================================
+ Coverage   76.41%   76.42%   +<.01%     
==========================================
  Files         158      158              
  Lines        9988     9992       +4     
  Branches     1262     1262              
==========================================
+ Hits         7632     7636       +4     
  Misses       2016     2016              
  Partials      340      340
Impacted Files Coverage Δ
readthedocs/search/indexes.py 77.04% <100%> (ø) ⬆️
readthedocs/projects/views/base.py 89.06% <100%> (+0.17%) ⬆️
readthedocs/oauth/services/base.py 46.15% <33.33%> (+0.59%) ⬆️
readthedocs/projects/tasks.py 69.37% <50%> (+0.06%) ⬆️
readthedocs/core/admin.py 72.72% <66.66%> (+0.5%) ⬆️
readthedocs/projects/constants.py 100% <0%> (ø) ⬆️
readthedocs/doc_builder/backends/sphinx.py 69.8% <0%> (ø) ⬆️

@davidfischer
Copy link
Contributor Author

I'm tempted to try and merge this in. If the DB is correct, then I think we'll be alright. Thoughts?

Let's aim for next week. I'll get the coverage into shape and re-run the test suite with Django 1.11.

@readthedocs readthedocs deleted a comment from 7mobile56 Nov 2, 2018
@davidfischer
Copy link
Contributor Author

I'm somewhat confused by the coverage results.

  • the patch increases the project overall coverage (I’m not sure how) but is rejected because the diff coverage is too low.
  • some files I didn’t modify are shown in the coverage report
  • I’m not really sure how to get the patch coverage up without writing tests that test other functionality

I think we are ok here.

@ericholscher ericholscher merged commit d2137df into master Nov 6, 2018
@ericholscher
Copy link
Member

🎉

@stsewd stsewd deleted the davidfischer/enable-timezone-support branch November 6, 2018 20:31
ericholscher added a commit that referenced this pull request Nov 20, 2018
Squashed commit of the following:

commit b5007bb
Author: Eric Holscher <[email protected]>
Date:   Tue Nov 20 11:41:40 2018 -0500

    Clean up HTMLFile Admin

commit 27e3dd4
Author: Eric Holscher <[email protected]>
Date:   Mon Nov 19 15:39:20 2018 -0500

    Set replicas to 2 so we have 3 total copies

commit ee13ed6
Merge: f221f97 ef0cd7b
Author: Eric Holscher <[email protected]>
Date:   Tue Nov 20 11:54:57 2018 -0500

    Merge remote-tracking branch 'origin/rel' into search-reapply

commit f221f97
Merge: 57c7b57 7bea6d8
Author: Eric Holscher <[email protected]>
Date:   Mon Nov 19 15:21:00 2018 -0500

    Merge pull request #4909 from safwanrahman/search_fix

    Tuning Elasticsearch for search improvements

commit 7bea6d8
Author: Safwan Rahman <[email protected]>
Date:   Sat Nov 17 02:17:22 2018 +0600

    more fix

commit 10a6590
Author: Safwan Rahman <[email protected]>
Date:   Sat Nov 17 01:50:48 2018 +0600

    adding comments

commit 40865ae
Author: Safwan Rahman <[email protected]>
Date:   Sat Nov 17 00:54:28 2018 +0600

    fixing test

commit 536874e
Author: Safwan Rahman <[email protected]>
Date:   Sat Nov 17 00:29:34 2018 +0600

    optimize for elasticsearch

commit 57c7b57
Author: Eric Holscher <[email protected]>
Date:   Tue Nov 6 12:10:08 2018 -0600

    Update migration

commit a1bd6a4
Merge: 95b23c2 d2137df
Author: Eric Holscher <[email protected]>
Date:   Tue Nov 6 12:08:38 2018 -0600

    Merge branch 'master' of github.com:rtfd/readthedocs.org into search-reapply

commit d2137df
Merge: b63ef59 953a4ee
Author: Eric Holscher <[email protected]>
Date:   Tue Nov 6 11:52:42 2018 -0600

    Merge pull request #4545 from rtfd/davidfischer/enable-timezone-support

    Enable timezone support and set timezone to UTC

commit 95b23c2
Merge: 75445f1 bc248aa
Author: Eric Holscher <[email protected]>
Date:   Thu Nov 1 14:48:13 2018 -0500

    Merge branch 'master' into search-reapply

commit 953a4ee
Merge: 0a01b96 104c3a6
Author: Eric Holscher <[email protected]>
Date:   Thu Nov 1 14:21:37 2018 -0500

    Merge remote-tracking branch 'origin/master' into davidfischer/enable-timezone-support

commit 75445f1
Author: Eric Holscher <[email protected]>
Date:   Wed Oct 10 15:45:29 2018 +0200

    One more test

commit fae116c
Author: Eric Holscher <[email protected]>
Date:   Wed Oct 10 15:45:03 2018 +0200

    Fix tests

commit 5b823ad
Author: Eric Holscher <[email protected]>
Date:   Wed Oct 10 15:43:53 2018 +0200

    Don't change the query param, keep it q

commit 621e14f
Author: Eric Holscher <[email protected]>
Date:   Wed Oct 10 14:12:13 2018 +0200

    Fix logic around search processing

commit 5af8307
Merge: 97e3ad8 c38efc8
Author: Eric Holscher <[email protected]>
Date:   Wed Oct 10 12:35:16 2018 +0200

    Merge remote-tracking branch 'origin/master' into search-reapply

commit 97e3ad8
Author: Eric Holscher <[email protected]>
Date:   Thu Oct 4 09:49:59 2018 +0200

    Revert "Revert "Merge pull request #4636 from rtfd/search_upgrade" (#4716)"

    This reverts commit 183b176.

commit 0a01b96
Author: David Fischer <[email protected]>
Date:   Tue Sep 18 15:38:00 2018 -0700

    Fix a merge fail

commit 73ad35c
Merge: ad7c76c ba34164
Author: David Fischer <[email protected]>
Date:   Tue Sep 18 15:11:48 2018 -0700

    Merge branch 'master' into davidfischer/enable-timezone-support

commit ad7c76c
Author: David Fischer <[email protected]>
Date:   Tue Aug 21 12:54:05 2018 -0700

    Found one more naive datetime

commit 46db5d9
Author: David Fischer <[email protected]>
Date:   Mon Aug 20 12:09:31 2018 -0700

    Enable timezone support and set timezone to UTC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: work in progress Pull request is not ready for full review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants