From 0ba9c4cbca5be658a05c52709a864fdc6537b5a7 Mon Sep 17 00:00:00 2001 From: Samuel Spencer Date: Fri, 13 May 2016 02:15:07 +0000 Subject: [PATCH] remove old <1.7 references, check py3, check py1.9 --- .travis.yml | 18 +++--- dbtemplates/__init__.py | 2 +- .../management/commands/sync_templates.py | 30 +++++----- dbtemplates/south_migrations/0001_initial.py | 55 ------------------- .../0002_auto__del_unique_template_name.py | 34 ------------ dbtemplates/south_migrations/__init__.py | 0 6 files changed, 24 insertions(+), 115 deletions(-) delete mode 100644 dbtemplates/south_migrations/0001_initial.py delete mode 100644 dbtemplates/south_migrations/0002_auto__del_unique_template_name.py delete mode 100644 dbtemplates/south_migrations/__init__.py diff --git a/.travis.yml b/.travis.yml index a8989d5..eb53660 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python python: -- 2.6 - 2.7 +- 3.5 before_install: - export DJANGO_SETTINGS_MODULE=dbtemplates.test_settings install: @@ -13,16 +13,14 @@ script: - coverage run --branch --source=dbtemplates `which django-admin.py` test dbtemplates - coverage report --omit="dbtemplates/test*,dbtemplates/migrations*" env: -- DJANGO="1.4.5 importlib" -- DJANGO="1.5.1 importlib" -- DJANGO=1.7.8 - DJANGO=1.8 -matrix: - exclude: - - python: 2.6 - env: DJANGO=1.7.8 - - python: 2.6 - env: DJANGO=1.8 +- DJANGO=1.9 +# matrix: +# exclude: +# - python: 2.6 +# env: DJANGO=1.7.8 +# - python: 2.6 +# env: DJANGO=1.8 deploy: provider: pypi user: jazzband diff --git a/dbtemplates/__init__.py b/dbtemplates/__init__.py index 974a8ff..f902680 100644 --- a/dbtemplates/__init__.py +++ b/dbtemplates/__init__.py @@ -1,2 +1,2 @@ # following PEP 386 -__version__ = "1.3.2" +__version__ = "1.4.1" diff --git a/dbtemplates/management/commands/sync_templates.py b/dbtemplates/management/commands/sync_templates.py index 3529e82..051592b 100644 --- a/dbtemplates/management/commands/sync_templates.py +++ b/dbtemplates/management/commands/sync_templates.py @@ -16,15 +16,12 @@ ALWAYS_ASK, FILES_TO_DATABASE, DATABASE_TO_FILES = ('0', '1', '2') DIRS = [] -if VERSION[:2] < (1, 8): - from django.template.loaders.app_directories import app_template_dirs - DIRS = settings.TEMPLATE_DIRS -else: - from django.template.utils import get_app_template_dirs - from django.template.loader import _engine_list - for engine in _engine_list(): - DIRS.extend(engine.dirs) - app_template_dirs = get_app_template_dirs('templates') + +from django.template.utils import get_app_template_dirs +from django.template.loader import _engine_list +for engine in _engine_list(): + DIRS.extend(engine.dirs) +app_template_dirs = get_app_template_dirs('templates') class Command(NoArgsCommand): @@ -121,11 +118,14 @@ class Command(NoArgsCommand): raise CommandError( u"Couldn't delete %s" % path) elif confirm == DATABASE_TO_FILES: - f = codecs.open(path, 'w', 'utf-8') try: - f.write(t.content) - finally: - f.close() - if delete: - t.delete() + f = codecs.open(path, 'w', 'utf-8') + try: + f.write(t.content) + finally: + f.close() + if delete: + t.delete() + except IOError: + pass # Unable to write to file break diff --git a/dbtemplates/south_migrations/0001_initial.py b/dbtemplates/south_migrations/0001_initial.py deleted file mode 100644 index 0e08603..0000000 --- a/dbtemplates/south_migrations/0001_initial.py +++ /dev/null @@ -1,55 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'Template' - db.create_table('django_template', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)), - ('content', self.gf('django.db.models.fields.TextField')(blank=True)), - ('creation_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), - ('last_changed', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), - )) - db.send_create_signal('dbtemplates', ['Template']) - - # Adding M2M table for field sites on 'Template' - db.create_table('django_template_sites', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('template', models.ForeignKey(orm['dbtemplates.template'], null=False)), - ('site', models.ForeignKey(orm['sites.site'], null=False)) - )) - db.create_unique('django_template_sites', ['template_id', 'site_id']) - - def backwards(self, orm): - # Deleting model 'Template' - db.delete_table('django_template') - - # Removing M2M table for field sites on 'Template' - db.delete_table('django_template_sites') - - models = { - 'dbtemplates.template': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Template', 'db_table': "'django_template'"}, - 'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'last_changed': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}) - }, - 'sites.site': { - 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, - 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - } - } - - complete_apps = ['dbtemplates'] diff --git a/dbtemplates/south_migrations/0002_auto__del_unique_template_name.py b/dbtemplates/south_migrations/0002_auto__del_unique_template_name.py deleted file mode 100644 index 418a3ab..0000000 --- a/dbtemplates/south_migrations/0002_auto__del_unique_template_name.py +++ /dev/null @@ -1,34 +0,0 @@ -# encoding: utf-8 -from south.db import db -from south.v2 import SchemaMigration - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Removing unique constraint on 'Template', fields ['name'] - db.delete_unique('django_template', ['name']) - - def backwards(self, orm): - # Adding unique constraint on 'Template', fields ['name'] - db.create_unique('django_template', ['name']) - - models = { - 'dbtemplates.template': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Template', 'db_table': "'django_template'"}, - 'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'last_changed': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}) - }, - 'sites.site': { - 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, - 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - } - } - - complete_apps = ['dbtemplates'] diff --git a/dbtemplates/south_migrations/__init__.py b/dbtemplates/south_migrations/__init__.py deleted file mode 100644 index e69de29..0000000