temporarily revert to case insensitive tag filter
authorAndrew Engelbrecht <sudoman@ninthfloor.org>
Wed, 8 Mar 2017 17:29:59 +0000 (12:29 -0500)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Wed, 8 Mar 2017 17:29:59 +0000 (12:29 -0500)
the case insensitive filter is not currently working.

mediagoblin_libreplanet/__init__.py
mediagoblin_libreplanet/lp_helper.py
mediagoblin_libreplanet/views.py

index a8403b1..37b43a4 100644 (file)
@@ -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 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
 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:
     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)
 
     return cursor.\
         filter((MediaEntry.media_type == type)
index 2c06053..63d1304 100644 (file)
@@ -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')
         .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.
 
 
index ceb96b6..b9cbe7c 100644 (file)
@@ -16,6 +16,7 @@
 
 from mediagoblin import mg_globals
 from mediagoblin.db.models import MediaEntry
 
 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
 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:
     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)
 
     cursor = cursor.\
              filter((MediaEntry.media_type == media_type)