From a783828ce75e93033858005bc61135bbacda2318 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Mon, 25 Apr 2016 14:09:37 -0700 Subject: [PATCH] Check to confirm that the user has a modern version of Cookiecutter. --- CHANGELOG.md | 4 ++++ hooks/pre_gen_project.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca37f5c4..97422f96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +### [2016-04-25] +### Added +- Check to confirm that the user has a modern version of Cookiecutter. (@pydanny) + ### [2016-04-20] ### Changed - Default to today's date in cookiecutter.json. (@audreyr) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 83b72649..3dfc190a 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,4 +1,8 @@ +import cookiecutter + project_slug = '{{ cookiecutter.project_slug }}' if hasattr(project_slug, 'isidentifier'): assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!' + +assert cookiecutter.__version__ > '1.3.0', 'Please upgrade your Cookiecutter installation'