From: Andrew Engelbrecht Date: Wed, 8 Mar 2017 17:29:59 +0000 (-0500) Subject: temporarily revert to case insensitive tag filter X-Git-Url: https://vcs.fsf.org/?p=mediagoblin-libreplanet.git;a=commitdiff_plain;h=e39ca90b2ea0f000ab589c156d8b5eeba1d3eff6;ds=inline temporarily revert to case insensitive tag filter the case insensitive filter is not currently working. --- diff --git a/mediagoblin_libreplanet/__init__.py b/mediagoblin_libreplanet/__init__.py index a8403b1..37b43a4 100644 --- a/mediagoblin_libreplanet/__init__.py +++ b/mediagoblin_libreplanet/__init__.py @@ -20,6 +20,7 @@ import os from mediagoblin import mg_globals from mediagoblin.tools.pluginapi import get_config, register_template_path, register_routes from mediagoblin.db.models import MediaEntry +from mediagoblin.db.util import media_entries_for_tag_slug from lp_helper import media_entries_for_tag_slug_case_insensitive from mediagoblin.tools.pagination import Pagination from mediagoblin.tools.response import render_to_response @@ -53,7 +54,9 @@ def lp_media_for_type(db, type, tag=None, max_items=MAX_HOME_ITEMS): if (tag == None): cursor = MediaEntry.query else: - cursor = media_entries_for_tag_slug_case_insensitive(db, tag) + ## case insensitive tag search is not working yet -- sudoman + #cursor = media_entries_for_tag_slug_case_insensitive(db, tag) + cursor = media_entries_for_tag_slug(db, tag) return cursor.\ filter((MediaEntry.media_type == type) diff --git a/mediagoblin_libreplanet/lp_helper.py b/mediagoblin_libreplanet/lp_helper.py index 2c06053..63d1304 100644 --- a/mediagoblin_libreplanet/lp_helper.py +++ b/mediagoblin_libreplanet/lp_helper.py @@ -25,5 +25,5 @@ def media_entries_for_tag_slug_case_insensitive(dummy_db, tag_slug): .join(MediaTag.tag_helper) \ .filter( (MediaEntry.state == u'processed') - & (Tag.slug.lower() == tag_slug.lower())) + & (Tag.slug.lower() == tag_slug.lower())) # Tag.slug.lower() currently doesn't work. diff --git a/mediagoblin_libreplanet/views.py b/mediagoblin_libreplanet/views.py index ceb96b6..b9cbe7c 100644 --- a/mediagoblin_libreplanet/views.py +++ b/mediagoblin_libreplanet/views.py @@ -16,6 +16,7 @@ from mediagoblin import mg_globals from mediagoblin.db.models import MediaEntry +from mediagoblin.db.util import media_entries_for_tag_slug from lp_helper import media_entries_for_tag_slug_case_insensitive from mediagoblin.tools.pagination import Pagination from mediagoblin.tools.response import render_to_response @@ -25,7 +26,9 @@ def type_listing(media_type, title, request, page, tag=None): if (tag == None): cursor = MediaEntry.query else: - cursor = media_entries_for_tag_slug_case_insensitive(request.db, tag) + ## case insensitive tag search is not working yet -- sudoman + #cursor = media_entries_for_tag_slug_case_insensitive(request.db, tag) + cursor = media_entries_for_tag_slug(request.db, tag) cursor = cursor.\ filter((MediaEntry.media_type == media_type)