Skip to content
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

Django 1.9 compatibility issues #507

Merged
merged 7 commits into from
Jun 16, 2017
Merged

Django 1.9 compatibility issues #507

merged 7 commits into from
Jun 16, 2017

Conversation

dracos
Copy link
Member

@dracos dracos commented Dec 23, 2015

Adds 1.9-1.11 support, makes tests actually run in python 3 (rather than python 2!), Travis container build, selenium switch to geckodriver.

@wfdd
Copy link

wfdd commented Feb 5, 2016

The installation instructions at https://mysociety.github.io/sayit/install/ will also need updating, as the syncdb command has been removed.

@dracos dracos force-pushed the 1.9-support branch 2 times, most recently from 43bc11f to eef3a3d Compare February 24, 2016 15:20
@dracos dracos force-pushed the version-1.4 branch 2 times, most recently from 352b4fd to 28961ca Compare February 24, 2016 15:46
@dracos dracos force-pushed the 1.9-support branch 2 times, most recently from 771b9ce to a434a6b Compare March 1, 2016 15:06
@dracos dracos force-pushed the 1.9-support branch 3 times, most recently from 9b0e6a0 to 578954c Compare January 5, 2017 17:32
@dracos dracos changed the base branch from version-1.4 to master January 5, 2017 18:15
@dracos dracos requested a review from mhl January 5, 2017 18:16
Copy link
Contributor

@mhl mhl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(n.b. I've just been reviewing this by eye - I haven't tried this latest version myself)

This looks good to me, but there are a few places I've commented on where I think a bit more explanation in the commit message or splitting some commits would be helpful for people looking through the history in the future.

@@ -176,7 +176,7 @@ def test_add_section_with_heading(self):
'heading': 'A test section'
})
new_section = Section.objects.order_by('-id')[0]
self.assertRedirects(resp, '%s' % new_section.slug)
self.assertRedirects(resp, '/%s' % new_section.slug)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a silly question, but why was this working before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before 1.9 it added scheme+host (and presumably therefore the initial /) implicitly. All redirect checks are relative since 1.9.

@@ -144,7 +144,7 @@ def test_speaker_headshots_in_speeches_section(self):
def test_create_speaker_with_long_image_url(self):
sixtyfive = '1234567890' * 6 + '12345'
ninetynine = '1234567890' * 9 + '123456789'
long_image_url = 'http://example.com/image%%E2%%97%%8F%s.jpg' % ninetynine
long_image_url = 'http://example.com/image%%E1%%BD%%A0%s.jpg' % ninetynine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This confused me a bit - could you possibly explain in the commit message that (presumably) U+25CF BLACK CIRCLE is rejected by get_valid_name() but U+1F60 GREEK SMALL LETTER OMEGA WITH PSILI, while a surprising character to have in a file name, is fine?

@@ -42,7 +42,7 @@ def read_file(filename):
'pytz >= 2013d',
'six >= 1.4.1',
django,
'Django-Select2 == 4.3.2',
'mysociety-Django-Select2 == 4.3.2.1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be in a separate commit with an explanation of why we're using our own fork?

tox.ini Outdated

[testenv]
commands =
flake8: flake8
py: pip install -e .[test]
py: python manage.py test
py: python manage.py test {posargs}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed now, but not before?

@dracos dracos force-pushed the 1.9-support branch 3 times, most recently from 202b6ba to 890326d Compare June 15, 2017 20:17
dracos added 7 commits June 16, 2017 18:32
* page_range is now an iterator.
* Test redirects need initial slash. (1)
* Text fix as uploaded files call get_valid_name(). (2)

(1) Django 1.9 started supporting relative redirects, whereas previously
it would automatically add scheme and host. Or something like that.

(2) This means it strips all non-alphanumeric Unicode characters, and
our test was previously using 'black circle' which is now stripped.
Use a fork of Django-Select2 because we are not as yet upgrading to
their version 5 rewrite. Switch xip.io to nip.io.

Also actually run python 3 tests on python 3!
* Upgrade project to use TEMPLATES setting.
* Length function now inbuilt.
* current_app on self.request.
* Make sure files saved inside MEDIA_ROOT.
* All allowed_hosts.
* Something tries to access queryset in 1.11.
* Fix for Django 1.11 changing behaviour of getlist().
@dracos dracos merged commit 2841ce7 into master Jun 16, 2017
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.

3 participants