aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Genannt <genannt@debian.org>2015-11-15 22:25:54 +0100
committerJonas Genannt <genannt@debian.org>2015-11-15 22:25:54 +0100
commit24cd0a91184be6fa20168f9b132b1ab3f5911949 (patch)
tree9577a4d01ab2b613757875dab7b7d8b1acb64b48
parent0b15d7564b3ceca4faebfc93401daa99102c241c (diff)
downloadpython-django-tagging-24cd0a91184be6fa20168f9b132b1ab3f5911949.tar
python-django-tagging-24cd0a91184be6fa20168f9b132b1ab3f5911949.tar.gz
reset patches that are included by the git migration
-rw-r--r--tagging/models.py15
-rw-r--r--tagging/tests/settings.py22
-rw-r--r--tagging/utils.py2
3 files changed, 19 insertions, 20 deletions
diff --git a/tagging/models.py b/tagging/models.py
index e13b077..860cf81 100644
--- a/tagging/models.py
+++ b/tagging/models.py
@@ -17,8 +17,6 @@ from tagging import settings
from tagging.utils import calculate_cloud, get_tag_list, get_queryset_and_model, parse_tag_input
from tagging.utils import LOGARITHMIC
-import collections
-
qn = connection.ops.quote_name
############
@@ -168,16 +166,9 @@ class TagManager(models.Manager):
# Django 1.2+
compiler = queryset.query.get_compiler(using='default')
extra_joins = ' '.join(compiler.get_from_clause()[0][1:])
- if isinstance(compiler, collections.Callable):
- # Django 1.7+
- where, params = queryset.query.where.as_sql(
- compiler, compiler.connection
- )
- else:
- # Django 1.2-1.6
- where, params = queryset.query.where.as_sql(
- compiler.quote_name_unless_alias, compiler.connection
- )
+ where, params = queryset.query.where.as_sql(
+ compiler.quote_name_unless_alias, compiler.connection
+ )
else:
# Django pre-1.2
extra_joins = ' '.join(queryset.query.get_from_clause()[0][1:])
diff --git a/tagging/tests/settings.py b/tagging/tests/settings.py
index 1985118..74eb909 100644
--- a/tagging/tests/settings.py
+++ b/tagging/tests/settings.py
@@ -3,14 +3,22 @@ DIRNAME = os.path.dirname(__file__)
DEFAULT_CHARSET = 'utf-8'
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': os.path.join(DIRNAME, 'tagging_test.db'),
- }
-}
+test_engine = os.environ.get("TAGGING_TEST_ENGINE", "sqlite3")
+
+DATABASE_ENGINE = test_engine
+DATABASE_NAME = os.environ.get("TAGGING_DATABASE_NAME", "tagging_test")
+DATABASE_USER = os.environ.get("TAGGING_DATABASE_USER", "")
+DATABASE_PASSWORD = os.environ.get("TAGGING_DATABASE_PASSWORD", "")
+DATABASE_HOST = os.environ.get("TAGGING_DATABASE_HOST", "localhost")
+
+if test_engine == "sqlite":
+ DATABASE_NAME = os.path.join(DIRNAME, 'tagging_test.db')
+ DATABASE_HOST = ""
+elif test_engine == "mysql":
+ DATABASE_PORT = os.environ.get("TAGGING_DATABASE_PORT", 3306)
+elif test_engine == "postgresql_psycopg2":
+ DATABASE_PORT = os.environ.get("TAGGING_DATABASE_PORT", 5432)
-SECRET_KEY = 'liewoo1jie7TahTao3ci7xayee8gieg9ukee'
INSTALLED_APPS = (
'django.contrib.contenttypes',
diff --git a/tagging/utils.py b/tagging/utils.py
index 759e8d8..e89bab0 100644
--- a/tagging/utils.py
+++ b/tagging/utils.py
@@ -232,7 +232,7 @@ def _calculate_tag_weight(weight, max_weight, distribution):
if distribution == LINEAR or max_weight == 1:
return weight
elif distribution == LOGARITHMIC:
- return min((max_weight, math.log(weight) * max_weight / math.log(max_weight)))
+ return math.log(weight) * max_weight / math.log(max_weight)
raise ValueError(_('Invalid distribution algorithm specified: %s.') % distribution)
def calculate_cloud(tags, steps=4, distribution=LOGARITHMIC):