[Python-modules-commits] [python-django-tagging] 01/01: Import python-django-tagging_0.4.5.orig.tar.gz

Christos Trochalakis ctrochalakis at moszumanska.debian.org
Tue Jan 17 14:13:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

ctrochalakis pushed a commit to branch upstream
in repository python-django-tagging.

commit 37c4438d808e0725290750a4b7c70b5c8da0f6ec
Author: Christos Trochalakis <yatiohi at ideopolis.gr>
Date:   Tue Jan 17 15:09:21 2017 +0200

    Import python-django-tagging_0.4.5.orig.tar.gz
---
 CHANGELOG.txt                    | 10 ++++++++++
 PKG-INFO                         | 14 ++++++++++++--
 README.rst                       |  2 +-
 django_tagging.egg-info/PKG-INFO | 14 ++++++++++++--
 tagging/__init__.py              |  2 +-
 tagging/fields.py                |  6 ++++++
 tagging/tests/models.py          |  5 +++++
 tagging/tests/tests.py           | 35 +++++++++++++++++++++++++++++++++++
 tagging/utils.py                 | 10 +++++++++-
 versions.cfg                     | 21 ++++++++++++---------
 10 files changed, 103 insertions(+), 16 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index d05ad6c..04343d0 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,16 @@
 Django Tagging Changelog
 ========================
 
+Version 0.4.5, 6th September 2016:
+----------------------------------
+
+* Fix on the previous compatiblity fix.
+
+Version 0.4.4, 5th September 2016:
+----------------------------------
+
+* Compatiblity fix for Django 1.10
+
 Version 0.4.3, 3rd May 2016:
 ----------------------------
 
diff --git a/PKG-INFO b/PKG-INFO
index a0b62e3..7216083 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-tagging
-Version: 0.4.3
+Version: 0.4.5
 Summary: Generic tagging application for Django
 Home-page: https://github.com/Fantomas42/django-tagging
 Author: Fantomas42
@@ -17,7 +17,7 @@ Description: ==============
         http://django-tagging.readthedocs.org/
         
         Note that this application requires Python 2.7 or later, and Django
-        1.7 or later. You can obtain Python from http://www.python.org/ and
+        1.8 or later. You can obtain Python from http://www.python.org/ and
         Django from http://www.djangoproject.com/.
         
         .. |travis-develop| image:: https://travis-ci.org/Fantomas42/django-tagging.png?branch=develop
@@ -31,6 +31,16 @@ Description: ==============
         Django Tagging Changelog
         ========================
         
+        Version 0.4.5, 6th September 2016:
+        ----------------------------------
+        
+        * Fix on the previous compatiblity fix.
+        
+        Version 0.4.4, 5th September 2016:
+        ----------------------------------
+        
+        * Compatiblity fix for Django 1.10
+        
         Version 0.4.3, 3rd May 2016:
         ----------------------------
         
diff --git a/README.rst b/README.rst
index 8a89c2f..fc565c6 100644
--- a/README.rst
+++ b/README.rst
@@ -9,7 +9,7 @@ This is a generic tagging application for Django projects
 http://django-tagging.readthedocs.org/
 
 Note that this application requires Python 2.7 or later, and Django
-1.7 or later. You can obtain Python from http://www.python.org/ and
+1.8 or later. You can obtain Python from http://www.python.org/ and
 Django from http://www.djangoproject.com/.
 
 .. |travis-develop| image:: https://travis-ci.org/Fantomas42/django-tagging.png?branch=develop
diff --git a/django_tagging.egg-info/PKG-INFO b/django_tagging.egg-info/PKG-INFO
index a0b62e3..7216083 100644
--- a/django_tagging.egg-info/PKG-INFO
+++ b/django_tagging.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-tagging
-Version: 0.4.3
+Version: 0.4.5
 Summary: Generic tagging application for Django
 Home-page: https://github.com/Fantomas42/django-tagging
 Author: Fantomas42
@@ -17,7 +17,7 @@ Description: ==============
         http://django-tagging.readthedocs.org/
         
         Note that this application requires Python 2.7 or later, and Django
-        1.7 or later. You can obtain Python from http://www.python.org/ and
+        1.8 or later. You can obtain Python from http://www.python.org/ and
         Django from http://www.djangoproject.com/.
         
         .. |travis-develop| image:: https://travis-ci.org/Fantomas42/django-tagging.png?branch=develop
@@ -31,6 +31,16 @@ Description: ==============
         Django Tagging Changelog
         ========================
         
+        Version 0.4.5, 6th September 2016:
+        ----------------------------------
+        
+        * Fix on the previous compatiblity fix.
+        
+        Version 0.4.4, 5th September 2016:
+        ----------------------------------
+        
+        * Compatiblity fix for Django 1.10
+        
         Version 0.4.3, 3rd May 2016:
         ----------------------------
         
diff --git a/tagging/__init__.py b/tagging/__init__.py
index c3f0017..7b59f65 100644
--- a/tagging/__init__.py
+++ b/tagging/__init__.py
@@ -1,7 +1,7 @@
 """
 Django-tagging
 """
-__version__ = '0.4.3'
+__version__ = '0.4.5'
 __license__ = 'BSD License'
 
 __author__ = 'Jonathan Buchanan'
diff --git a/tagging/fields.py b/tagging/fields.py
index dd4a936..7a05f99 100644
--- a/tagging/fields.py
+++ b/tagging/fields.py
@@ -99,6 +99,12 @@ class TagField(CharField):
         """
         Helper: set an instance's tag cache.
         """
+        # The next instruction does nothing particular,
+        # but needed to by-pass the deferred fields system
+        # when saving an instance, which check the keys present
+        # in instance.__dict__.
+        # The issue is introducted in Django 1.10
+        instance.__dict__[self.attname] = tags
         setattr(instance, '_%s_cache' % self.attname, tags)
 
     def get_internal_type(self):
diff --git a/tagging/tests/models.py b/tagging/tests/models.py
index e095b3c..c240ff1 100644
--- a/tagging/tests/models.py
+++ b/tagging/tests/models.py
@@ -50,3 +50,8 @@ class FormTest(models.Model):
 
 class FormTestNull(models.Model):
     tags = TagField(null=True)
+
+
+class FormMultipleFieldTest(models.Model):
+    tagging_field = TagField('Test', help_text='Test')
+    name = models.CharField(max_length=50)
diff --git a/tagging/tests/tests.py b/tagging/tests/tests.py
index f398a9f..1368414 100644
--- a/tagging/tests/tests.py
+++ b/tagging/tests/tests.py
@@ -21,6 +21,7 @@ from tagging.tests.models import Perch
 from tagging.tests.models import Parrot
 from tagging.tests.models import FormTest
 from tagging.tests.models import FormTestNull
+from tagging.tests.models import FormMultipleFieldTest
 from tagging.utils import LINEAR
 from tagging.utils import LOGARITHMIC
 from tagging.utils import get_tag
@@ -460,6 +461,39 @@ class TestModelTagField(TestCase):
         f1 = FormTestNull()
         self.assertEqual(f1.tags, '')
 
+    def test_fix_update_tag_field_deferred(self):
+        """
+        Bug introduced in Django 1.10
+        the TagField is considered "deferred" on Django 1.10
+        because instance.__dict__ is not populated by the TagField
+        instance, so it's excluded when updating a model instance.
+
+        Note: this does not append if you only have one TagField
+        in your model...
+        """
+        f1 = FormMultipleFieldTest.objects.create(tagging_field='one two')
+        self.assertEqual(f1.tagging_field, 'one two')
+        tags = Tag.objects.get_for_object(f1)
+        self.assertEqual(len(tags), 2)
+        test1_tag = get_tag('one')
+        test2_tag = get_tag('two')
+        self.assertTrue(test1_tag in tags)
+        self.assertTrue(test2_tag in tags)
+
+        f1.tagging_field = f1.tagging_field + ' three'
+        f1.save()
+        self.assertEqual(f1.tagging_field, 'one two three')
+        tags = Tag.objects.get_for_object(f1)
+        self.assertEqual(len(tags), 3)
+        test3_tag = get_tag('three')
+        self.assertTrue(test3_tag in tags)
+
+        f1again = FormMultipleFieldTest.objects.get(pk=f1.pk)
+        self.assertEqual(f1again.tagging_field, 'one two three')
+
+        tags = Tag.objects.get_for_object(f1again)
+        self.assertEqual(len(tags), 3)
+
 
 class TestSettings(TestCase):
     def setUp(self):
@@ -1081,6 +1115,7 @@ class TestTagFieldInForms(TestCase):
         spaces = Tag.objects.create(name='spa ces')
         comma = Tag.objects.create(name='com,ma')
         self.assertEqual(edit_string_for_tags([plain]), 'plain')
+        self.assertEqual(edit_string_for_tags([spaces]), '"spa ces"')
         self.assertEqual(edit_string_for_tags([plain, spaces]),
                          'plain, spa ces')
         self.assertEqual(edit_string_for_tags([plain, spaces, comma]),
diff --git a/tagging/utils.py b/tagging/utils.py
index 3487453..cd7e0ee 100644
--- a/tagging/utils.py
+++ b/tagging/utils.py
@@ -121,7 +121,15 @@ def edit_string_for_tags(tags):
         glue = ', '
     else:
         glue = ' '
-    return glue.join(names)
+    result = glue.join(names)
+
+    # If we only had one name, and it had spaces,
+    # we need to enclose it in quotes.
+    # Otherwise, it's interpreted as two tags.
+    if len(names) == 1 and use_commas:
+        result = '"' + result + '"'
+
+    return result
 
 
 def get_queryset_and_model(queryset_or_model):
diff --git a/versions.cfg b/versions.cfg
index 7443eb8..d8e1ba2 100644
--- a/versions.cfg
+++ b/versions.cfg
@@ -1,24 +1,27 @@
 [versions]
 blessings                       = 1.6
 buildout-versions-checker       = 1.9.3
+configparser                    = 3.5.0
 coverage                        = 4.0.3
-django                          = 1.9.5
-flake8                          = 2.5.4
+django                          = 1.10
+enum34                          = 1.1.6
+flake8                          = 3.0.4
 futures                         = 3.0.5
-mccabe                          = 0.4.0
+mccabe                          = 0.5.2
 nose                            = 1.3.7
 nose-progressive                = 1.5.1
 nose-sfd                        = 0.4
 packaging                       = 16.7
 pbp.recipe.noserunner           = 0.2.6
 pep8                            = 1.5.7
-pyflakes                        = 1.0.0
-pyparsing                       = 2.1.1
+pycodestyle                     = 2.0.0
+pyflakes                        = 1.2.3
+pyparsing                       = 2.1.8
 python-coveralls                = 2.7.0
-pyyaml                          = 3.11
-requests                        = 2.10.0
-setuptools                      = 20.10.1
+pyyaml                          = 3.12
+requests                        = 2.11.1
+setuptools                      = 26.1.1
 sh                              = 1.11
 six                             = 1.10.0
-zc.buildout                     = 2.5.1
+zc.buildout                     = 2.5.2
 zc.recipe.egg                   = 2.0.3

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django-tagging.git



More information about the Python-modules-commits mailing list