From 59c65c56ab0dc5ad9e6b79e28fcd67e85e12cf52 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Tue, 18 Aug 2015 14:15:26 +0200 Subject: [PATCH 1/3] fix setup for python 3 --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 778878f..fdd5aa3 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,9 @@ from setuptools import setup, find_packages def read(*parts): - return codecs.open(os.path.join(os.path.dirname(__file__), *parts)).read() + filename = os.path.join(os.path.dirname(__file__), *parts) + with codecs.open(filename, encoding='utf-8') as fp: + return fp.read() def find_version(*file_paths): From c8a048352ec3ac2939e0b3a30005319b0b67d494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Kut=C3=BD?= <6du1ro.n@gmail.com> Date: Wed, 19 Aug 2015 11:42:39 +0200 Subject: [PATCH 2/3] Fix some Python 3 issues - thanks @vikingco --- dbtemplates/conf.py | 3 ++- dbtemplates/management/commands/sync_templates.py | 4 ++++ dbtemplates/utils/template.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dbtemplates/conf.py b/dbtemplates/conf.py index 2a420a3..4abb258 100644 --- a/dbtemplates/conf.py +++ b/dbtemplates/conf.py @@ -2,6 +2,7 @@ import posixpath from django.core.exceptions import ImproperlyConfigured from django.conf import settings +from django.utils.six import string_types from appconf import AppConf @@ -31,7 +32,7 @@ class DbTemplatesConf(AppConf): return "dbtemplates" else: return "default" - if isinstance(value, basestring) and value.startswith("dbtemplates."): + if isinstance(value, string_types) and value.startswith("dbtemplates."): raise ImproperlyConfigured("Please upgrade to one of the " "supported backends as defined " "in the Django docs.") diff --git a/dbtemplates/management/commands/sync_templates.py b/dbtemplates/management/commands/sync_templates.py index a25b4b0..3529e82 100644 --- a/dbtemplates/management/commands/sync_templates.py +++ b/dbtemplates/management/commands/sync_templates.py @@ -4,6 +4,10 @@ from optparse import make_option from django import VERSION from django.contrib.sites.models import Site from django.core.management.base import CommandError, NoArgsCommand +try: + from django.utils.six import input as raw_input +except ImportError: + pass from dbtemplates.conf import settings from dbtemplates.models import Template diff --git a/dbtemplates/utils/template.py b/dbtemplates/utils/template.py index 526fcb7..c7b224a 100644 --- a/dbtemplates/utils/template.py +++ b/dbtemplates/utils/template.py @@ -60,6 +60,6 @@ def get_template_source(name): def check_template_syntax(template): try: Template(template.content) - except TemplateSyntaxError, e: + except TemplateSyntaxError as e: return (False, e) return (True, None) From 35a57bbcb15e4a139a995990694eb967ba5949ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Kut=C3=BD?= <6du1ro.n@gmail.com> Date: Wed, 19 Aug 2015 14:56:00 +0200 Subject: [PATCH 3/3] drop support for django < 1.3.7 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 25eb0f4..bdca644 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ script: - coverage run --branch --source=dbtemplates `which django-admin.py` test dbtemplates - coverage report --omit="dbtemplates/test*,dbtemplates/migrations*" env: - - DJANGO=1.3.7 - DJANGO=1.4.5 - DJANGO=1.5.1 - DJANGO=1.7.8