Add Python 2 check to `wagtail` command

pull/4416/merge
Matt Westcott 2018-03-22 16:47:03 +00:00
rodzic 59506ae69f
commit 96061ae301
3 zmienionych plików z 14 dodań i 1 usunięć

Wyświetl plik

@ -34,6 +34,7 @@ Changelog
2.0.1 (xx.xx.xxxx) - IN DEVELOPMENT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Added error notification when running the `wagtail` command on Python <3.4 (Matt Westcott)
* Fix: Draftail now supports features specified via the `WAGTAILADMIN_RICH_TEXT_EDITORS` setting (Todd Dembrey)
* Fix: Password reset form no longer indicates whether the email is recognised, as per standard Django behaviour (Bertrand Bordage)
* Fix: `UserAttributeSimilarityValidator` is now correctly enforced on user creation / editing forms (Tim Heap)

Wyświetl plik

@ -10,6 +10,8 @@ Wagtail 2.0.1 release notes - IN DEVELOPMENT
What's new
==========
* Added error notification when running the ``wagtail`` command on Python <3.4 (Matt Westcott)
Bug fixes
~~~~~~~~~

Wyświetl plik

@ -8,6 +8,16 @@ from argparse import ArgumentParser
from difflib import unified_diff
from django.core.management import ManagementUtility
# Need to use the django.utils.six version of print, to avoid a syntax error on Py2 when using print(..., end='')
from django.utils.six import print_
CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 4)
if CURRENT_PYTHON < REQUIRED_PYTHON:
sys.stderr.write("This version of Wagtail requires Python {}.{} or above - you are running {}.{}\n".format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))
sys.exit(1)
def pluralize(value, arg='s'):
@ -227,7 +237,7 @@ class UpdateModulePaths(Command):
with fileinput.FileInput(filename, inplace=True) as f:
for original_line in f:
line = self._rewrite_line(original_line)
print(line, end='') # NOQA
print_(line, end='') # NOQA
if line != original_line:
change_count += 1