[python-django-tagging] fixed use of types which are not available in Py3
Jakub QB Dorňák
jdornak at fedoraproject.org
Sat Dec 21 22:47:17 UTC 2013
commit 34521046429b9f2c2d20625c348de8f455f7cb1e
Author: Jakub Dorňák <jdornak at redhat.com>
Date: Sat Dec 21 23:42:46 2013 +0100
fixed use of types which are not available in Py3
python-django-tagging-0.3.1-utils-python3.patch | 49 +++++++++++++++++++++++
python-django-tagging.spec | 7 +++-
2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/python-django-tagging-0.3.1-utils-python3.patch b/python-django-tagging-0.3.1-utils-python3.patch
new file mode 100644
index 0000000..97fa667
--- /dev/null
+++ b/python-django-tagging-0.3.1-utils-python3.patch
@@ -0,0 +1,49 @@
+--- django-tagging-0.3.1/tagging/utils.py.orig 2013-12-05 14:45:26.931702819 +0100
++++ django-tagging-0.3.1/tagging/utils.py 2013-12-05 14:46:15.896743894 +0100
+@@ -3,7 +3,10 @@ Tagging utilities - from user tag input
+ calculation.
+ """
+ import math
+-import types
++try:
++ long, unicode
++except:
++ long, unicode = int, str
+
+ from django.db.models.query import QuerySet
+ try:
+@@ -168,18 +171,18 @@ def get_tag_list(tags):
+ return [tags]
+ elif isinstance(tags, QuerySet) and tags.model is Tag:
+ return tags
+- elif isinstance(tags, types.StringTypes):
++ elif isinstance(tags, (str, unicode)):
+ return Tag.objects.filter(name__in=parse_tag_input(tags))
+- elif isinstance(tags, (types.ListType, types.TupleType)):
++ elif isinstance(tags, (list, tuple)):
+ if len(tags) == 0:
+ return tags
+ contents = set()
+ for item in tags:
+- if isinstance(item, types.StringTypes):
++ if isinstance(item, (str, unicode)):
+ contents.add('string')
+ elif isinstance(item, Tag):
+ contents.add('tag')
+- elif isinstance(item, (types.IntType, types.LongType)):
++ elif isinstance(item, (int, long)):
+ contents.add('int')
+ if len(contents) == 1:
+ if 'string' in contents:
+@@ -210,9 +213,9 @@ def get_tag(tag):
+ return tag
+
+ try:
+- if isinstance(tag, types.StringTypes):
++ if isinstance(tag, (str, unicode)):
+ return Tag.objects.get(name=tag)
+- elif isinstance(tag, (types.IntType, types.LongType)):
++ elif isinstance(tag, (int, long)):
+ return Tag.objects.get(id=tag)
+ except Tag.DoesNotExist:
+ pass
diff --git a/python-django-tagging.spec b/python-django-tagging.spec
index 0e6601a..16963cf 100644
--- a/python-django-tagging.spec
+++ b/python-django-tagging.spec
@@ -3,7 +3,7 @@
%global pkgname django-tagging
Name: python-django-tagging
Version: 0.3.1
-Release: 9%{?dist}
+Release: 10%{?dist}
Summary: A generic tagging application for Django projects
Group: Development/Languages
@@ -13,6 +13,7 @@ Source0: http://pypi.python.org/packages/source/d/%{pkgname}/%{pkgname}-%
#md5=a0855f2b044db15f3f8a025fa1016ddf
Patch0: python-django-tagging-0.3.1-tests-python3.patch
Patch1: python-django-tagging-0.3.1-force_unicode-python3.patch
+Patch2: python-django-tagging-0.3.1-utils-python3.patch
BuildArch: noarch
BuildRequires: python2-devel
@@ -49,6 +50,7 @@ simple.
%setup -q -n %{pkgname}-%{version}
%patch0 -p1 -b .tests-python3
%patch1 -p1 -b .force_unicode-python3
+%patch2 -p1 -b .utils-python3
%if 0%{?with_python3}
cp -a . %{py3dir}
@@ -89,6 +91,9 @@ popd
%changelog
+* Thu Dec 5 2013 Jakub Dorňák <jdornak at redhat.com> - 0.3.1-10
+- fixed use of types which are not available in Py3
+
* Sun Dec 1 2013 Jakub Dorňák <jdornak at redhat.com> - 0.3.1-9
- added python3 subpackage
More information about the scm-commits
mailing list