[Python-modules-commits] [django-fsm] 01/06: Import django-fsm_2.6.0.orig.tar.gz
Michael Fladischer
fladi at moszumanska.debian.org
Mon Jun 19 19:02:16 UTC 2017
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository django-fsm.
commit a7dc534af78976604bdbbe7410d0cf3e2bc2b1e8
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Mon Jun 19 20:48:39 2017 +0200
Import django-fsm_2.6.0.orig.tar.gz
---
.gitignore | 8 ++--
CHANGELOG.rst | 7 ++++
README.rst | 14 +++----
django_fsm/__init__.py | 2 +-
.../management/commands/graph_transitions.py | 6 +--
setup.py | 4 +-
tests/settings.py | 9 +----
.../tests/test_model_create_with_generic.py | 44 ++++++++++++++++++++++
tox.ini | 26 ++++++-------
9 files changed, 80 insertions(+), 40 deletions(-)
diff --git a/.gitignore b/.gitignore
index f94ac6f..a9a6d20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
*.pyc
-dist
-django_fsm.egg-info
-reports
-.tox
+dist/
+build/
+django_fsm.egg-info/
+.tox/
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 9d38bd5..c802c3d 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,13 @@
Changelog
=========
+django-fsm 2.6.0 2017-06-08
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Fix django 1.11 compatibility
+- Fix TypeError in `graph_transitions` command when using django's lazy translations
+
+
django-fsm 2.5.0 2017-03-04
~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/README.rst b/README.rst
index 31cca8b..196e2b8 100644
--- a/README.rst
+++ b/README.rst
@@ -126,13 +126,13 @@ Use the conditions like this:
.. code:: python
@transition(field=state, source='new', target='published', conditions=[can_publish])
- def publish(self):
+ def publish(self):
"""
Side effects galore
"""
@transition(field=state, source='*', target='destroyed', conditions=[can_destroy])
- def destroy(self):
+ def destroy(self):
"""
Side effects galore
"""
@@ -411,15 +411,11 @@ your ``INSTALLED_APPS``:
Changelog
---------
-django-fsm 2.5.0 2017-03-04
+django-fsm 2.6.0 2017-06-08
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- graph_transition command fix for django 1.10
-- graph_transition command supports GET_STATE targets
-- signal data extended with method args/kwargs and field
-- sets allowed to be passed to the transition decorator
-
-
+- Fix django 1.11 compatibility
+- Fix TypeError in `graph_transitions` command when using django's lazy translations
.. |Build Status| image:: https://travis-ci.org/kmmbvnr/django-fsm.svg?branch=master
:target: https://travis-ci.org/kmmbvnr/django-fsm
diff --git a/django_fsm/__init__.py b/django_fsm/__init__.py
index d93cff9..ce6a8c7 100644
--- a/django_fsm/__init__.py
+++ b/django_fsm/__init__.py
@@ -222,7 +222,7 @@ class FSMFieldDescriptor(object):
def __get__(self, instance, type=None):
if instance is None:
- raise AttributeError('Can only be accessed via an instance.')
+ return self
return self.field.get_state(instance)
def __set__(self, instance, value):
diff --git a/django_fsm/management/commands/graph_transitions.py b/django_fsm/management/commands/graph_transitions.py
index 8eea6bf..e18c85d 100644
--- a/django_fsm/management/commands/graph_transitions.py
+++ b/django_fsm/management/commands/graph_transitions.py
@@ -3,7 +3,7 @@ import graphviz
from optparse import make_option
from django.core.management.base import BaseCommand
-from django.utils.encoding import smart_text
+from django.utils.encoding import force_text
from django_fsm import FSMFieldMixin, GET_STATE, RETURN_VALUE
@@ -101,12 +101,12 @@ def generate_dot(fields_data):
def add_transition(transition_source, transition_target, transition_name, source_name, field, sources, targets, edges):
target_name = node_name(field, transition_target)
if isinstance(transition_source, int):
- source_label = [smart_text(name[1]) for name in field.choices if name[0] == transition_source][0]
+ source_label = [force_text(name[1]) for name in field.choices if name[0] == transition_source][0]
else:
source_label = transition_source
sources.add((source_name, source_label))
if isinstance(transition_target, int):
- target_label = [smart_text(name[1]) for name in field.choices if name[0] == transition_target][0]
+ target_label = [force_text(name[1]) for name in field.choices if name[0] == transition_target][0]
else:
target_label = transition_target
targets.add((target_name, target_label))
diff --git a/setup.py b/setup.py
index 61eb245..0695a90 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ except IOError:
setup(
name='django-fsm',
- version='2.5.0',
+ version='2.6.0',
description='Django friendly finite state machine support.',
author='Mikhail Podgurskiy',
author_email='kmmbvnr at gmail.com',
@@ -28,12 +28,14 @@ setup(
"Framework :: Django :: 1.8",
"Framework :: Django :: 1.9",
"Framework :: Django :: 1.10",
+ "Framework :: Django :: 1.11",
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
'Framework :: Django',
'Topic :: Software Development :: Libraries :: Python Modules',
]
diff --git a/tests/settings.py b/tests/settings.py
index 4163ff0..502d79f 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -1,5 +1,5 @@
PROJECT_APPS = ('django_fsm', 'testapp',)
-INSTALLED_APPS = ('django.contrib.contenttypes', 'django.contrib.auth', 'guardian', 'django_jenkins') + PROJECT_APPS
+INSTALLED_APPS = ('django.contrib.contenttypes', 'django.contrib.auth', 'guardian', ) + PROJECT_APPS
DATABASE_ENGINE = 'sqlite3'
SECRET_KEY = 'nokey'
MIDDLEWARE_CLASSES = ()
@@ -9,9 +9,4 @@ DATABASES = {
}
}
-JENKINS_TASKS = (
- 'django_jenkins.tasks.run_pep8',
- 'django_jenkins.tasks.run_pyflakes'
-)
-
-ANONYMOUS_USER_ID=0
+ANONYMOUS_USER_ID = 0
diff --git a/tests/testapp/tests/test_model_create_with_generic.py b/tests/testapp/tests/test_model_create_with_generic.py
new file mode 100644
index 0000000..3576476
--- /dev/null
+++ b/tests/testapp/tests/test_model_create_with_generic.py
@@ -0,0 +1,44 @@
+try:
+ from django.contrib.contenttypes.fields import GenericForeignKey
+except ImportError:
+ # Django 1.6
+ from django.contrib.contenttypes.generic import GenericForeignKey
+from django.contrib.contenttypes.models import ContentType
+from django.db import models
+from django.test import TestCase
+from django_fsm import FSMField, transition
+
+
+class Ticket(models.Model):
+
+ class Meta:
+ app_label = 'testapp'
+
+
+class Task(models.Model):
+ class STATE:
+ NEW = 'new'
+ DONE = 'done'
+
+ content_type = models.ForeignKey(ContentType)
+ object_id = models.PositiveIntegerField()
+ causality = GenericForeignKey('content_type', 'object_id')
+ state = FSMField(default=STATE.NEW)
+
+ @transition(field=state, source=STATE.NEW, target=STATE.DONE)
+ def do(self):
+ pass
+
+ class Meta:
+ app_label = 'testapp'
+
+
+class Test(TestCase):
+ def setUp(self):
+ self.ticket = Ticket.objects.create()
+
+ def test_model_objects_create(self):
+ """Check a model with state field can be created
+ if one of the other fields is a property or a virtual field.
+ """
+ Task.objects.create(causality=self.ticket)
diff --git a/tox.ini b/tox.ini
index 6856c4b..d5d1df1 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,35 +3,31 @@ envlist =
py26-dj{16}
py27-dj{16,18,19,110,111}
py33-dj{16,18}
- py{34,35}-dj{18,19,110,111}
+ py{34,35,36}-dj{18,19,110,111}
skipsdist = True
[testenv]
deps =
py26: ipython==2.1.0
- {py27,py32,py33,py34,py35}: ipython==4.1.1
+ {py27,py32,py33}: ipython==5.4.1
+ {py34,py35,py36}: ipython==6.1.0
dj16: Django==1.6.11
- dj16: django-jenkins==0.17.0
dj16: coverage<=3.999
dj16: django-guardian==1.3.2
- dj18: Django==1.8.13
- dj18: django-jenkins==0.18.1
+ dj18: Django==1.8.18
dj18: coverage==4.1
dj18: django-guardian==1.4.4
- dj19: Django==1.9.7
- dj19: django-jenkins==0.19.0
+ dj19: Django==1.9.13
dj19: coverage==4.1
dj19: django-guardian==1.4.4
- dj110: Django==1.10.5
- dj110: django-jenkins==0.19.0
+ dj110: Django==1.10.7
dj110: coverage==4.1
dj110: django-guardian==1.4.4
- dj111: Django==1.11b1
- dj111: django-jenkins==0.110.0
+ dj111: Django==1.11.2
dj111: coverage==4.3.4
- dj111: django-guardian==1.4.6
- graphviz==0.4.10
+ dj111: django-guardian==1.4.8
+ graphviz==0.7.1
pep8==1.7.0
- pyflakes==1.0.0
+ pyflakes==1.5.0
ipdb==0.8.1
-commands = python tests/manage.py {posargs:jenkins --pep8-max-line-length=150 --output-dir=reports/{envname}}
+commands = {posargs:python ./tests/manage.py test}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-fsm.git
More information about the Python-modules-commits
mailing list