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

Christopher Baines cbaines-guest at moszumanska.debian.org
Wed May 11 11:05:27 UTC 2016


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

cbaines-guest pushed a commit to branch master
in repository python-django-tagging.

commit 89d0f2751f1f19bc2b902280383ebb4e244c7452
Author: Christopher Baines <mail at cbaines.net>
Date:   Wed May 11 10:41:42 2016 +0100

    Import python-django-tagging_0.4.3.orig.tar.gz
---
 CHANGELOG.txt                        | 22 ++++++++++++++++++++++
 PKG-INFO                             | 24 +++++++++++++++++++++++-
 django_tagging.egg-info/PKG-INFO     | 24 +++++++++++++++++++++++-
 django_tagging.egg-info/SOURCES.txt  |  1 +
 tagging/__init__.py                  |  2 +-
 tagging/migrations/0001_initial.py   |  2 ++
 tagging/migrations/0002_on_delete.py | 30 ++++++++++++++++++++++++++++++
 tagging/models.py                    | 14 +++++++++++---
 tagging/tests/models.py              |  3 ++-
 tagging/tests/tests.py               | 29 ++++++++++++++++++++++++++---
 tagging/tests/utils.py               | 20 ++++++++++++++++++--
 tagging/utils.py                     |  4 +++-
 versions.cfg                         | 31 ++++++++++++++++---------------
 13 files changed, 178 insertions(+), 28 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index b41ff9b..d05ad6c 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,28 @@
 Django Tagging Changelog
 ========================
 
+Version 0.4.3, 3rd May 2016:
+----------------------------
+
+* Add missing migration for ``on_delete``
+
+Version 0.4.2, 2nd May 2016:
+----------------------------
+
+* Fix tag weight
+* Reduce warnings for recent versions of Django
+
+Version 0.4.1, 15th January 2016:
+---------------------------------
+
+* Typo fixes
+* Support apps
+
+Version 0.4, 15th June 2015:
+----------------------------
+
+* Modernization of the package
+
 Version 0.3.6, 13th May 2015:
 -----------------------------
 
diff --git a/PKG-INFO b/PKG-INFO
index 59be396..a0b62e3 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-tagging
-Version: 0.4.1
+Version: 0.4.3
 Summary: Generic tagging application for Django
 Home-page: https://github.com/Fantomas42/django-tagging
 Author: Fantomas42
@@ -31,6 +31,28 @@ Description: ==============
         Django Tagging Changelog
         ========================
         
+        Version 0.4.3, 3rd May 2016:
+        ----------------------------
+        
+        * Add missing migration for ``on_delete``
+        
+        Version 0.4.2, 2nd May 2016:
+        ----------------------------
+        
+        * Fix tag weight
+        * Reduce warnings for recent versions of Django
+        
+        Version 0.4.1, 15th January 2016:
+        ---------------------------------
+        
+        * Typo fixes
+        * Support apps
+        
+        Version 0.4, 15th June 2015:
+        ----------------------------
+        
+        * Modernization of the package
+        
         Version 0.3.6, 13th May 2015:
         -----------------------------
         
diff --git a/django_tagging.egg-info/PKG-INFO b/django_tagging.egg-info/PKG-INFO
index 59be396..a0b62e3 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.1
+Version: 0.4.3
 Summary: Generic tagging application for Django
 Home-page: https://github.com/Fantomas42/django-tagging
 Author: Fantomas42
@@ -31,6 +31,28 @@ Description: ==============
         Django Tagging Changelog
         ========================
         
+        Version 0.4.3, 3rd May 2016:
+        ----------------------------
+        
+        * Add missing migration for ``on_delete``
+        
+        Version 0.4.2, 2nd May 2016:
+        ----------------------------
+        
+        * Fix tag weight
+        * Reduce warnings for recent versions of Django
+        
+        Version 0.4.1, 15th January 2016:
+        ---------------------------------
+        
+        * Typo fixes
+        * Support apps
+        
+        Version 0.4, 15th June 2015:
+        ----------------------------
+        
+        * Modernization of the package
+        
         Version 0.3.6, 13th May 2015:
         -----------------------------
         
diff --git a/django_tagging.egg-info/SOURCES.txt b/django_tagging.egg-info/SOURCES.txt
index 15f5763..2ee9f10 100644
--- a/django_tagging.egg-info/SOURCES.txt
+++ b/django_tagging.egg-info/SOURCES.txt
@@ -28,6 +28,7 @@ tagging/settings.py
 tagging/utils.py
 tagging/views.py
 tagging/migrations/0001_initial.py
+tagging/migrations/0002_on_delete.py
 tagging/migrations/__init__.py
 tagging/templatetags/__init__.py
 tagging/templatetags/tagging_tags.py
diff --git a/tagging/__init__.py b/tagging/__init__.py
index 8e300fd..c3f0017 100644
--- a/tagging/__init__.py
+++ b/tagging/__init__.py
@@ -1,7 +1,7 @@
 """
 Django-tagging
 """
-__version__ = '0.4.1'
+__version__ = '0.4.3'
 __license__ = 'BSD License'
 
 __author__ = 'Jonathan Buchanan'
diff --git a/tagging/migrations/0001_initial.py b/tagging/migrations/0001_initial.py
index d784916..b5f56a2 100644
--- a/tagging/migrations/0001_initial.py
+++ b/tagging/migrations/0001_initial.py
@@ -35,9 +35,11 @@ class Migration(migrations.Migration):
                     verbose_name='object id', db_index=True)),
                 ('content_type', models.ForeignKey(
                     verbose_name='content type',
+                    on_delete=models.SET_NULL,
                     to='contenttypes.ContentType')),
                 ('tag', models.ForeignKey(
                     related_name='items', verbose_name='tag',
+                    on_delete=models.SET_NULL,
                     to='tagging.Tag')),
             ],
             options={
diff --git a/tagging/migrations/0002_on_delete.py b/tagging/migrations/0002_on_delete.py
new file mode 100644
index 0000000..60be305
--- /dev/null
+++ b/tagging/migrations/0002_on_delete.py
@@ -0,0 +1,30 @@
+from django.db import models
+from django.db import migrations
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('tagging', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='taggeditem',
+            name='content_type',
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='contenttypes.ContentType',
+                verbose_name='content type'),
+        ),
+        migrations.AlterField(
+            model_name='taggeditem',
+            name='tag',
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                related_name='items',
+                to='tagging.Tag',
+                verbose_name='tag'),
+        ),
+    ]
diff --git a/tagging/models.py b/tagging/models.py
index 9e89e43..03304e9 100644
--- a/tagging/models.py
+++ b/tagging/models.py
@@ -431,12 +431,18 @@ class TaggedItemManager(models.Manager):
         GROUP BY %(model_pk)s
         ORDER BY %(count)s DESC
         %(limit_offset)s"""
+        try:
+            tagging_table = qn(self.model._meta.get_field(
+                'tag').remote_field.model._meta.db_table)
+        except AttributeError:  # Django < 1.9
+            tagging_table = qn(self.model._meta.get_field(
+                'tag').rel.to._meta.db_table)
         query = query % {
             'model_pk': '%s.%s' % (model_table, qn(model._meta.pk.column)),
             'count': qn('count'),
             'model': model_table,
             'tagged_item': qn(self.model._meta.db_table),
-            'tag': qn(self.model._meta.get_field('tag').rel.to._meta.db_table),
+            'tag': tagging_table,
             'content_type_id': content_type.pk,
             'related_content_type_id': related_content_type.pk,
             # Hardcoding this for now just to get tests working again - this
@@ -492,11 +498,13 @@ class TaggedItem(models.Model):
     tag = models.ForeignKey(
         Tag,
         verbose_name=_('tag'),
-        related_name='items')
+        related_name='items',
+        on_delete=models.CASCADE)
 
     content_type = models.ForeignKey(
         ContentType,
-        verbose_name=_('content type'))
+        verbose_name=_('content type'),
+        on_delete=models.CASCADE)
 
     object_id = models.PositiveIntegerField(
         _('object id'),
diff --git a/tagging/tests/models.py b/tagging/tests/models.py
index 1babd58..e095b3c 100644
--- a/tagging/tests/models.py
+++ b/tagging/tests/models.py
@@ -12,7 +12,8 @@ class Perch(models.Model):
 @python_2_unicode_compatible
 class Parrot(models.Model):
     state = models.CharField(max_length=50)
-    perch = models.ForeignKey(Perch, null=True)
+    perch = models.ForeignKey(Perch, null=True,
+                              on_delete=models.CASCADE)
 
     def __str__(self):
         return self.state
diff --git a/tagging/tests/tests.py b/tagging/tests/tests.py
index c3ff3b6..f398a9f 100644
--- a/tagging/tests/tests.py
+++ b/tagging/tests/tests.py
@@ -22,11 +22,13 @@ from tagging.tests.models import Parrot
 from tagging.tests.models import FormTest
 from tagging.tests.models import FormTestNull
 from tagging.utils import LINEAR
+from tagging.utils import LOGARITHMIC
 from tagging.utils import get_tag
 from tagging.utils import get_tag_list
 from tagging.utils import calculate_cloud
 from tagging.utils import parse_tag_input
 from tagging.utils import edit_string_for_tags
+from tagging.utils import _calculate_tag_weight
 
 #############
 # Utilities #
@@ -249,6 +251,22 @@ class TestCalculateCloud(TestCase):
             raise self.failureException(
                 'a ValueError exception was supposed to be raised!')
 
+    def test_calculate_tag_weight(self):
+        self.assertEqual(
+            _calculate_tag_weight(10, 20, LINEAR),
+            10)
+        self.assertEqual(
+            _calculate_tag_weight(10, 20, LOGARITHMIC),
+            15.37243573680482)
+
+    def test_calculate_tag_weight_invalid_size(self):
+        self.assertEqual(
+            _calculate_tag_weight(10, 10, LOGARITHMIC),
+            10.0)
+        self.assertEqual(
+            _calculate_tag_weight(26, 26, LOGARITHMIC),
+            26.0)
+
 ###########
 # Tagging #
 ###########
@@ -1122,9 +1140,14 @@ class TestTagAdminForm(TestCase):
 
 @override_settings(
     ROOT_URLCONF='tagging.tests.urls',
-    TEMPLATE_LOADERS=(
-        'tagging.tests.utils.VoidLoader',
-    ),
+    TEMPLATES=[
+        {
+            'BACKEND': 'django.template.backends.django.DjangoTemplates',
+            'OPTIONS': {
+                'loaders': ('tagging.tests.utils.VoidLoader',)
+            }
+        }
+    ]
 )
 class TestTaggedObjectList(TestCase):
 
diff --git a/tagging/tests/utils.py b/tagging/tests/utils.py
index 2f041d9..b86c3e1 100644
--- a/tagging/tests/utils.py
+++ b/tagging/tests/utils.py
@@ -1,10 +1,17 @@
 """
 Tests utils for tagging.
 """
-from django.template.loader import BaseLoader
+from django.template.loaders.base import Loader
+try:
+    from django.template import Origin
+except ImportError:
+    class Origin(object):
+        def __init__(self, **kwargs):
+            for k, v in kwargs.items():
+                setattr(self, k, v)
 
 
-class VoidLoader(BaseLoader):
+class VoidLoader(Loader):
     """
     Template loader which is always returning
     an empty template.
@@ -12,5 +19,14 @@ class VoidLoader(BaseLoader):
     is_usable = True
     _accepts_engine_in_init = True
 
+    def get_template_sources(self, template_name):
+        yield Origin(
+            name='voidloader',
+            template_name=template_name,
+            loader=self)
+
+    def get_contents(self, origin):
+        return ''
+
     def load_template_source(self, template_name, template_dirs=None):
         return ('', 'voidloader:%s' % template_name)
diff --git a/tagging/utils.py b/tagging/utils.py
index 6c1492f..3487453 100644
--- a/tagging/utils.py
+++ b/tagging/utils.py
@@ -233,7 +233,9 @@ def _calculate_tag_weight(weight, max_weight, distribution):
     if distribution == LINEAR or max_weight == 1:
         return weight
     elif distribution == LOGARITHMIC:
-        return math.log(weight) * max_weight / math.log(max_weight)
+        return min(
+            math.log(weight) * max_weight / math.log(max_weight),
+            max_weight)
     raise ValueError(
         _('Invalid distribution algorithm specified: %s.') % distribution)
 
diff --git a/versions.cfg b/versions.cfg
index 49ece04..7443eb8 100644
--- a/versions.cfg
+++ b/versions.cfg
@@ -1,23 +1,24 @@
 [versions]
 blessings                       = 1.6
-buildout-versions-checker       = 1.9.2
-coverage                        = 3.7.1
-django                          = 1.8.1
-flake8                          = 2.4.0
-futures                         = 3.0.2
-mccabe                          = 0.3
-nose                            = 1.3.6
+buildout-versions-checker       = 1.9.3
+coverage                        = 4.0.3
+django                          = 1.9.5
+flake8                          = 2.5.4
+futures                         = 3.0.5
+mccabe                          = 0.4.0
+nose                            = 1.3.7
 nose-progressive                = 1.5.1
 nose-sfd                        = 0.4
-packaging                       = 15.1
+packaging                       = 16.7
 pbp.recipe.noserunner           = 0.2.6
 pep8                            = 1.5.7
-pyflakes                        = 0.8.1
-python-coveralls                = 2.5.0
+pyflakes                        = 1.0.0
+pyparsing                       = 2.1.1
+python-coveralls                = 2.7.0
 pyyaml                          = 3.11
-requests                        = 2.7.0
-setuptools                      = 15.2
+requests                        = 2.10.0
+setuptools                      = 20.10.1
 sh                              = 1.11
-six                             = 1.9.0
-zc.buildout                     = 2.3.1
-zc.recipe.egg                   = 2.0.1
+six                             = 1.10.0
+zc.buildout                     = 2.5.1
+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