Merge with a233a5a00aabf7377ed98d2a067c1f26a93691e7
authorymh <ymh.work@gmail.com>
Mon, 15 Oct 2012 23:48:25 +0200
changeset 855 f9bd3988ada5
parent 854 e4be64dd42af (diff)
parent 848 a233a5a00aab (current diff)
child 856 db90b623c4ea
Merge with a233a5a00aabf7377ed98d2a067c1f26a93691e7
--- a/.hgtags	Mon Oct 15 10:59:04 2012 +0200
+++ b/.hgtags	Mon Oct 15 23:48:25 2012 +0200
@@ -107,3 +107,4 @@
 0000000000000000000000000000000000000000 V01.23
 626573ed450f361c429b5208011f4285b689646f V01.23
 f8bd692229d72085d262dbaf5708b0fb555d9b95 V01.24
+96b7309ae220055ec844eb047513828842883fbe V01.25
--- a/.settings/org.eclipse.core.resources.prefs	Mon Oct 15 10:59:04 2012 +0200
+++ b/.settings/org.eclipse.core.resources.prefs	Mon Oct 15 23:48:25 2012 +0200
@@ -1,43 +1,44 @@
-eclipse.preferences.version=1
-encoding//src/ldt/ldt/core/migrations/0001_initial.py=utf-8
-encoding//src/ldt/ldt/core/migrations/0002_auto__del_owner.py=utf-8
-encoding//src/ldt/ldt/indexation/backends/elasticsearch_backend.py=utf-8
-encoding//src/ldt/ldt/indexation/highlighter.py=utf-8
-encoding//src/ldt/ldt/indexation/models.py=utf-8
-encoding//src/ldt/ldt/indexation/query_parser.py=utf-8
-encoding//src/ldt/ldt/indexation/search_indexes.py=utf-8
-encoding//src/ldt/ldt/indexation/tests.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0001_initial.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0002_auto__add_field_media_mimetype_field__chg_field_media_external_src_url.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0003_auto__chg_field_project_owner.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0004_auto__add_field_project_description.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0005_add_permissions.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0006_auto__add_field_media_image.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0007_auto__add_field_content_image__del_field_media_image.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0008_auto__add_field_project_image.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0009_auto__chg_field_content_image__chg_field_project_image.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0010_auto__add_annotationstat.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0011_gen_stat_annotation.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0012_auto__add_field_content_last_annotated.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0013_auto__add_field_content_front_project__chg_field_content_last_annotate.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0014_auto__del_annotationstat__chg_field_content_last_annotated.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0016_one_to_one_stat_annotation.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0017_correct_image_path.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0019_recalculate_media_hash_src.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0021_recalculate_segment_id_hash_script.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0022_auto__add_unique_media_src_hash__chg_field_segment_cutting_id__chg_fie.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py=utf-8
-encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8
-encoding//src/ldt/ldt/management/utils.py=utf-8
-encoding//src/ldt/ldt/test/test_runner.py=utf-8
-encoding//src/ldt/ldt/text/migrations/0001_initial.py=utf-8
-encoding//src/ldt/ldt/user/migrations/0001_initial.py=utf-8
-encoding//src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py=utf-8
-encoding//virtualenv/web/env/guardianenv/Lib/site-packages/guardian/migrations/0001_initial.py=utf-8
-encoding//virtualenv/web/env/venv_platform/lib/python2.7/site-packages/haystack/backends/__init__.py=utf-8
-encoding//web/ldtplatform/config.py=utf-8
-encoding//web/ldtplatform/settings.py=utf-8
-encoding/<project>=UTF-8
+eclipse.preferences.version=1
+encoding//src/ldt/ldt/core/migrations/0001_initial.py=utf-8
+encoding//src/ldt/ldt/core/migrations/0002_auto__del_owner.py=utf-8
+encoding//src/ldt/ldt/indexation/backends/elasticsearch_backend.py=utf-8
+encoding//src/ldt/ldt/indexation/highlighter.py=utf-8
+encoding//src/ldt/ldt/indexation/models.py=utf-8
+encoding//src/ldt/ldt/indexation/query_parser.py=utf-8
+encoding//src/ldt/ldt/indexation/search_indexes.py=utf-8
+encoding//src/ldt/ldt/indexation/tests.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0001_initial.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0002_auto__add_field_media_mimetype_field__chg_field_media_external_src_url.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0003_auto__chg_field_project_owner.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0004_auto__add_field_project_description.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0005_add_permissions.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0006_auto__add_field_media_image.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0007_auto__add_field_content_image__del_field_media_image.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0008_auto__add_field_project_image.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0009_auto__chg_field_content_image__chg_field_project_image.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0010_auto__add_annotationstat.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0011_gen_stat_annotation.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0012_auto__add_field_content_last_annotated.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0013_auto__add_field_content_front_project__chg_field_content_last_annotate.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0014_auto__del_annotationstat__chg_field_content_last_annotated.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0016_one_to_one_stat_annotation.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0017_correct_image_path.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0019_recalculate_media_hash_src.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0021_recalculate_segment_id_hash_script.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0022_auto__add_unique_media_src_hash__chg_field_segment_cutting_id__chg_fie.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/migrations/0024_auto__chg_field_tag_name.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8
+encoding//src/ldt/ldt/management/utils.py=utf-8
+encoding//src/ldt/ldt/test/test_runner.py=utf-8
+encoding//src/ldt/ldt/text/migrations/0001_initial.py=utf-8
+encoding//src/ldt/ldt/user/migrations/0001_initial.py=utf-8
+encoding//src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py=utf-8
+encoding//virtualenv/web/env/guardianenv/Lib/site-packages/guardian/migrations/0001_initial.py=utf-8
+encoding//virtualenv/web/env/venv_platform/lib/python2.7/site-packages/haystack/backends/__init__.py=utf-8
+encoding//web/ldtplatform/config.py=utf-8
+encoding//web/ldtplatform/settings.py=utf-8
+encoding/<project>=UTF-8
--- a/src/ldt/ldt/__init__.py	Mon Oct 15 10:59:04 2012 +0200
+++ b/src/ldt/ldt/__init__.py	Mon Oct 15 23:48:25 2012 +0200
@@ -1,4 +1,4 @@
-VERSION = (1, 24, 0, "final", 0)
+VERSION = (1, 25, 0, "final", 0)
 
 
 def get_version():
--- a/src/ldt/ldt/ldt_utils/contentindexer.py	Mon Oct 15 10:59:04 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/contentindexer.py	Mon Oct 15 23:48:25 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()")                
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/migrations/0024_auto__chg_field_tag_name.py	Mon Oct 15 23:48:25 2012 +0200
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+from south.db import db
+from south.v2 import SchemaMigration
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+
+        # Changing field 'Tag.name'
+        db.alter_column('tagging_tag', 'name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) #@UndefinedVariable
+
+    def backwards(self, orm):
+
+        # Changing field 'Tag.name'
+        db.alter_column('tagging_tag', 'name', self.gf('django.db.models.fields.CharField')(max_length=50, unique=True)) #@UndefinedVariable
+
+    models = {
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'tagging.tag': {
+            'Meta': {'ordering': "('name',)", 'object_name': 'Tag'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'})
+        },
+        'tagging.taggeditem': {
+            'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TaggedItem'},
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+            'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['tagging.Tag']"})
+        }
+    }
+
+    complete_apps = ['tagging']
\ No newline at end of file
--- a/src/ldt/ldt/ldt_utils/models.py	Mon Oct 15 10:59:04 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/models.py	Mon Oct 15 23:48:25 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	Mon Oct 15 10:59:04 2012 +0200
+++ b/src/ldt/ldt/settings.py	Mon Oct 15 23:48:25 2012 +0200
@@ -72,9 +72,6 @@
 LOG_LEVEL = getattr(settings, 'LOG_LEVEL', logging.INFO)
 EMPTY_MEDIA_EXTERNALID = getattr(settings, 'EMPTY_MEDIA_EXTERNALID', None)
 
-GLOBAL_LOG_LEVEL = LOG_LEVEL
-GLOBAL_LOG_HANDLERS = [logging.FileHandler(LOG_FILE)]
-
 TEST_WEBSERVER_ADDRPORT = getattr(settings, 'TEST_WEBSERVER_ADDRPORT', '127.0.0.1:8000')
 
 ACCOUNT_ACTIVATION_DAYS = getattr(settings, 'ACCOUNT_ACTIVATION_DAYS', 7)
@@ -99,6 +96,10 @@
 DEFAULT_USER_ICON = "thumbnails/users/user_default_icon.png"
 DEFAULT_GROUP_ICON = "thumbnails/groups/group_default_icon.png"
 
+# force settings value
+if(not hasattr(settings, 'MAX_TAG_LENGTH') or getattr(settings, 'MAX_TAG_LENGTH') > 255):
+    setattr(settings, 'MAX_TAG_LENGTH', 255)
+
 EXTERNAL_STREAM_SRC = getattr(settings, 'EXTERNAL_STREAM_SRC', ['youtube.com', 'dailymotion.com', 'vimeo.com'])
 
 HAYSTACK_CONNECTIONS = {
--- a/src/ldt/ldt/user/admin.py	Mon Oct 15 10:59:04 2012 +0200
+++ b/src/ldt/ldt/user/admin.py	Mon Oct 15 23:48:25 2012 +0200
@@ -17,7 +17,14 @@
     model = UserProfile
     
 class UserProfileAdmin(UserAdmin):
-    inlines = [UserProfileInline, ]
+    def add_view(self, *args, **kwargs):
+        self.inlines = []
+        return super(UserProfileAdmin, self).add_view(*args, **kwargs)
+    
+    def change_view(self, *args, **kwargs):
+        self.inlines = [UserProfileInline]
+        return super(UserAdmin, self).change_view(*args, **kwargs)
+
 
 class LdtAdmin(UserProfileAdmin):    
     list_display = ('username', 'email', 'first_name', 'last_name')
--- a/src/ldt/ldt/user/models.py	Mon Oct 15 10:59:04 2012 +0200
+++ b/src/ldt/ldt/user/models.py	Mon Oct 15 23:48:25 2012 +0200
@@ -40,7 +40,7 @@
     @staticmethod
     def create_user_profile(sender, instance, created, **kwargs):
         if created:
-            UserProfile.objects.create(user=instance)
+            UserProfile.objects.get_or_create(user=instance)
             everyone, _ = Group.objects.get_or_create(name=settings.PUBLIC_GROUP_NAME)
             instance.groups.add(everyone)
 
Binary file web/ldtplatform/locale/en/LC_MESSAGES/django.mo has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldtplatform/locale/en/LC_MESSAGES/django.po	Mon Oct 15 23:48:25 2012 +0200
@@ -0,0 +1,57 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-10-11 17:31+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: settings.py:41
+msgid "French"
+msgstr "French"
+
+#: settings.py:42
+msgid "English"
+msgstr "English"
+
+#: settings.py:43
+msgid "Japanese"
+msgstr "Japanese"
+
+#: templates/admin/base_site.html:4
+msgid "Django site admin"
+msgstr "Django site admin"
+
+#: templates/admin/base_site.html:7
+msgid "Django administration"
+msgstr "Django administration"
+
+#: templates/registration/login.html:17
+msgid "Log in"
+msgstr "Log in"
+
+#: templates/registration/login.html:20
+msgid "Sorry, that's not a valid username or password."
+msgstr "Sorry, that's not a valid username or password."
+
+#: templates/registration/login.html:31
+msgid "Forget password?"
+msgstr "Forgot password?"
+
+#: templates/registration/login.html:34
+msgid "login"
+msgstr "login"
+
+#: templates/registration/login.html:41
+msgid "Or login with your external account"
+msgstr "Or login with your external account"
Binary file web/ldtplatform/locale/ja/LC_MESSAGES/django.mo has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/ldtplatform/locale/ja/LC_MESSAGES/django.po	Mon Oct 15 23:48:25 2012 +0200
@@ -0,0 +1,58 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-10-11 17:31+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+
+#: settings.py:41
+msgid "French"
+msgstr "フランス語"
+
+#: settings.py:42
+msgid "English"
+msgstr "英語"
+
+#: settings.py:43
+msgid "Japanese"
+msgstr "日本語"
+
+#: templates/admin/base_site.html:4
+msgid "Django site admin"
+msgstr "Django サイト管理"
+
+#: templates/admin/base_site.html:7
+msgid "Django administration"
+msgstr "Django サイト管理"
+
+#: templates/registration/login.html:17
+msgid "Log in"
+msgstr "ログイン"
+
+#: templates/registration/login.html:20
+msgid "Sorry, that's not a valid username or password."
+msgstr "Sorry, that's not a valid username or password."
+
+#: templates/registration/login.html:31
+msgid "Forget password?"
+msgstr "パスワードまたはユーザ名を忘れましたか?"
+
+#: templates/registration/login.html:34
+msgid "login"
+msgstr "ログイン"
+
+#: templates/registration/login.html:41
+msgid "Or login with your external account"
+msgstr "Or login with your external account"
--- a/web/ldtplatform/settings.py	Mon Oct 15 10:59:04 2012 +0200
+++ b/web/ldtplatform/settings.py	Mon Oct 15 23:48:25 2012 +0200
@@ -257,11 +257,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/".
@@ -273,4 +268,9 @@
 # URL that handles the media served from MEDIA_ROOT.
 if not "MEDIA_URL" in locals():
     MEDIA_URL = BASE_URL + 'static/media/'
+
+#forced settings    
+MAX_TAG_LENGTH = 255
+FORCE_LOWERCASE_TAGS = True
+