--- a/src/ldt/ldt/ldt_utils/contentindexer.py Thu Oct 11 19:54:35 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/contentindexer.py Sun Oct 14 13:31:34 2012 +0200
@@ -1,12 +1,15 @@
-from django.conf import settings
+from ldt import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from ldt.ldt_utils.models import Segment, Content, Project
from ldt.ldt_utils.utils import reduce_text_node
from ldt.ldt_utils.stat import update_stat_project
import lxml.etree
+import tagging.utils
import urllib #@UnresolvedImport
-# import ldt.utils.log
+import logging
+
+logger = logging.getLogger(__name__)
def Property(func):
return property(**func())
@@ -50,26 +53,25 @@
elementId = elementNode.get(u"id", None)
tags = elementNode.get(u"tags", None)
-
- if tags is not None:
- tags.replace(u",", u";")
-
+
if tags is None or len(tags) == 0:
tags = u""
restagnode = elementNode.xpath("tag/text()", smart_strings=False)
for tagnode in restagnode:
- tags = tags + u" ; " + tagnode
+ tags = tags + u"," + tagnode
if tags is None or len(tags) == 0:
tags = u""
restagnode = elementNode.xpath("tags/tag/text()", smart_strings=False)
for tagnode in restagnode:
- tags = tags + u" ; " + tagnode
+ tags = tags + u"," + tagnode
if tags is None:
tags = u""
- tags = u";".join([tag[0:50] for tag in tags.split(u";")])
+
+ tags_list = [tag[:settings.MAX_TAG_LENGTH] for tag in tagging.utils.parse_tag_input(tags)]
+ tags = u",".join(tags_list)
title = reduce_text_node(elementNode, "title/text()")
--- a/src/ldt/ldt/ldt_utils/models.py Thu Oct 11 19:54:35 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/models.py Sun Oct 14 13:31:34 2012 +0200
@@ -20,6 +20,7 @@
import os.path
import re
import tagging.fields
+import tagging.utils
import uuid
import logging
from shutil import rmtree, move
@@ -797,6 +798,7 @@
def save(self, *args, **kwargs):
self.id_hash = generate_hash(self.__unicode__())
+
super(Segment, self).save(*args, **kwargs)
--- a/src/ldt/ldt/settings.py Thu Oct 11 19:54:35 2012 +0200
+++ b/src/ldt/ldt/settings.py Sun Oct 14 13:31:34 2012 +0200
@@ -99,6 +99,9 @@
DEFAULT_USER_ICON = "thumbnails/users/user_default_icon.png"
DEFAULT_GROUP_ICON = "thumbnails/groups/group_default_icon.png"
+MAX_TAG_LENGTH = getattr(settings, 'MAX_TAG_LENGTH', 50)
+FORCE_LOWERCASE_TAGS = getattr(settings, 'FORCE_LOWERCASE_TAGS', True)
+
EXTERNAL_STREAM_SRC = getattr(settings, 'EXTERNAL_STREAM_SRC', ['youtube.com', 'dailymotion.com', 'vimeo.com'])
HAYSTACK_CONNECTIONS = {
--- a/web/ldtplatform/settings.py Thu Oct 11 19:54:35 2012 +0200
+++ b/web/ldtplatform/settings.py Sun Oct 14 13:31:34 2012 +0200
@@ -226,6 +226,9 @@
PUBLIC_GROUP_NAME = 'everyone'
MAX_USERS_SEARCH = 20
+MAX_TAG_LENGTH = 50
+FORCE_LOWERCASE_TAGS = True
+
SYNTAX = {
'++' : 'OK',
'--' : 'KO',
@@ -257,11 +260,6 @@
if not "LOGIN_ERROR_URL" in locals():
LOGIN_ERROR_URL = BASE_URL + 'ldtplatform/accounts/login'
-if not "GLOBAL_LOG_LEVEL" in locals():
- GLOBAL_LOG_LEVEL = LOG_LEVEL
-if not "GLOBAL_LOG_HANDLERS" in locals():
- GLOBAL_LOG_HANDLERS = [{'handler':logging.FileHandler(LOG_FILE), 'format':"%(asctime)s - %(levelname)s : %(message)s"}]
-
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".