--- a/.hgtags Fri Nov 30 11:51:56 2012 +0100
+++ b/.hgtags Mon Dec 03 11:27:35 2012 +0100
@@ -131,3 +131,6 @@
caa3a2695cb7710bbab7970ebd0e0b28eea140a9 V01.33
41eb88128c8fad65408b2db4965ffda6c75d21bc V01.33
659ca382a67d90fd7fdda8c4f422091434c97d86 V01.34
+a05ad02125c58e419fcbd52475c9f39be35f576e V01.35
+a774af5e10f40b65dd1ec748ad36e9ed4e9a294e V01.36
+89e3320ac56c863333e3e5317d1c7fced478cc05 V01.36
--- a/.settings/org.eclipse.core.resources.prefs Fri Nov 30 11:51:56 2012 +0100
+++ b/.settings/org.eclipse.core.resources.prefs Mon Dec 03 11:27:35 2012 +0100
@@ -1,45 +1,42 @@
-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/migrations/0025_chg_site_domain.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
\ No newline at end of file
+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/migrations/0025_chg_site_domain.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/<project>=UTF-8
--- a/src/ldt/ldt/__init__.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/__init__.py Mon Dec 03 11:27:35 2012 +0100
@@ -1,4 +1,4 @@
-VERSION = (1, 34, 0, "final", 0)
+VERSION = (1, 37, 0, "final", 0)
def get_version():
--- a/src/ldt/ldt/api/ldt/resources/project.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/api/ldt/resources/project.py Mon Dec 03 11:27:35 2012 +0100
@@ -1,13 +1,17 @@
+from django.conf import settings
from django.conf.urls.defaults import url
+from django.contrib.auth.models import Group
+from guardian.shortcuts import assign
from ldt.ldt_utils.models import Project
from ldt.api.ldt.authentication import SessionAuthentication
from ldt.api.ldt.serializers.cinelabserializer import CinelabSerializer
from ldt.api.ldt.resources import ContentResource
from ldt.api.ldt.resources.user import UserResource
+from ldt.security import protect_models, unprotect_models
from tastypie.authorization import Authorization
from tastypie.resources import Bundle, ModelResource, ALL
from tastypie import fields
-from ldt.security import protect_models, unprotect_models
+
class ProjectResource(ModelResource):
contents = fields.ManyToManyField(ContentResource, 'contents')
@@ -46,10 +50,16 @@
else:
kwargs['ldt_id'] = bundle_or_obj.ldt_id
return self._build_reverse_url("api_dispatch_detail", kwargs=kwargs)
-
- # TEMPORARY (used before authentication/authorization, because saving a project modifies a Content (via ContentStat))
- def save_m2m(self, bundle):
+
+ def obj_create(self, bundle, request=None, **kwargs):
unprotect_models()
- super(ProjectResource, self).save_m2m(bundle)
+ bundle = super(ProjectResource, self).obj_create(bundle, request)
+ # Assign permission for the owner
+ assign('view_project', request.user, bundle.obj)
+ assign('change_project', request.user, bundle.obj)
+ # Since the project is published by default, we assign permission for the everyone group
+ everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME)
+ assign('ldt_utils.view_project', everyone, bundle.obj)
protect_models()
+ return bundle
\ No newline at end of file
--- a/src/ldt/ldt/api/ldt/serializers/cinelabserializer.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/api/ldt/serializers/cinelabserializer.py Mon Dec 03 11:27:35 2012 +0100
@@ -60,7 +60,6 @@
"contents*": ["IRI_ID_1","IRI_ID_2"]
"owner*": "user_id"
"""
- logging.debug("FROM cinelab content = " + content)
cinelab = simplejson.loads(content)
meta = cinelab["meta"]
--- a/src/ldt/ldt/auth/views.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/auth/views.py Mon Dec 03 11:27:35 2012 +0100
@@ -8,7 +8,6 @@
redirect_field_name=REDIRECT_FIELD_NAME,
authentication_form=AuthenticationForm,
current_app=None):
- social_img=[{"facebook" : "ldt/img/logo_facebook.png",}, {"twitter" : "ldt/img/logo_twitter.png",}, {"google" : "ldt/img/logo_google.png",}, {"yahoo" : "ldt/img/logo_yahoo.png"},]
- extra_context = {'social_list': social_list, 'social_img' : social_img}
+ extra_context = {'social_list': social_list}
return django_login(request, template_name, redirect_field_name, authentication_form, current_app, extra_context)
--- a/src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py Mon Dec 03 11:27:35 2012 +0100
@@ -11,8 +11,11 @@
Sites = orm['sites.Site']
site = Sites.objects.get(id=settings.SITE_ID)
web_url = settings.WEB_URL
- domain_area = web_url.split("//",1)
- domain = domain_area[1]
+ if (web_url.startswith("http://")):
+ domain_area = web_url.split("//",1)
+ domain = domain_area[1]
+ else :
+ domain=web_url
if site.domain!=domain:
site.domain = domain
site.save()
--- a/src/ldt/ldt/ldt_utils/tests/content_tests.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/tests/content_tests.py Mon Dec 03 11:27:35 2012 +0100
@@ -16,6 +16,8 @@
import unittest
import uuid
import logging
+import os
+import exceptions
class ContentTest(TestCase):
@@ -29,7 +31,7 @@
self.user = User()
self.user.username = 'blop'
-
+
#test the creation of a content without media
def test_create_content_v1(self):
self.cont12 = Content(iriurl="id12/iriurl12", duration = 100)
@@ -46,8 +48,54 @@
self.cont13.iri_id = "id113"
self.cont13.save()
- self.assertEqual(Content.objects.get(iri_id=self.cont13.iri_id), self.cont13)
-
+ self.assertEqual(Content.objects.get(iri_id=self.cont13.iri_id), self.cont13)
+
+ #test the creation of content without reading permission
+ def test_create_content_v3(self):
+ import sys
+ ldt_dir = os.path.join(settings.MEDIA_ROOT, "ldt")
+ if sys.platform == 'win32':
+ logging.debug("windows 3")
+ else:
+ logging.debug("linux")
+ os.chmod(ldt_dir, 0577)
+
+ self.cont17 = Content(iriurl="id17/iriurl17", duration = 100)
+ self.cont17.iri_id = 'id117'
+ with self.assertRaises(WindowsError):
+ self.cont17.save()
+ with self.assertRaises(Content.DoesNotExist):
+ Content.objects.get(iri_id=self.cont17.iri_id)
+
+ if sys.platform == 'win32':
+ logging.debug("windows 4")
+ else:
+ logging.debug("linux")
+ os.chmod(ldt_dir, 0700)
+
+ #test the creation of content without reading permission
+ def test_create_content_v4(self):
+ import sys
+ ldt_dir = os.path.join(settings.MEDIA_ROOT, "ldt")
+ if sys.platform == 'win32':
+ logging.debug("windows 3")
+ else:
+ logging.debug("linux")
+ os.chmod(ldt_dir, 0377)
+
+ self.cont18 = Content(iriurl="id18/iriurl18", duration = 100)
+ self.cont18.iri_id = 'id118'
+ with self.assertRaises(WindowsError):
+ self.cont18.save()
+ with self.assertRaises(Content.DoesNotExist):
+ Content.objects.get(iri_id=self.cont18.iri_id)
+
+ if sys.platform == 'win32':
+ logging.debug("windows 4")
+ else:
+ logging.debug("linux")
+ os.chmod(ldt_dir, 0700)
+
#test the deletion of a content without media
def test_del_content_v1(self):
self.cont14 = Content(iriurl="id14/iriurl14", duration = 100)
--- a/src/ldt/ldt/ldt_utils/tests/ldt_tests.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/tests/ldt_tests.py Mon Dec 03 11:27:35 2012 +0100
@@ -68,7 +68,6 @@
self.assertEqual(ldoc.xpath("/iri/medias/media")[1].get("id"), self.cont2.iri_id)
f.close()
- """
def test_generate_init(self):
self.cont3 = Content(iriurl="id3/iriurl3", duration=111)
self.cont3.iri_id = "id3"
@@ -82,7 +81,6 @@
ldoc = self.LU.generate_init([], 'ldt.ldt_utils.views.search_ldt')
self.assertEqual(ldoc.xpath("/iri/files/init")[0].tag, "init")
self.assertEqual(ldoc.xpath("/iri/files/library")[0].tag, "library")
- """
def test_create_ldt(self):
self.cont5 = Content(iriurl="id5/iriurl5", duration=111)
--- a/src/ldt/ldt/ldt_utils/tests/project_tests.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/tests/project_tests.py Mon Dec 03 11:27:35 2012 +0100
@@ -52,4 +52,26 @@
with self.assertRaises(Project.DoesNotExist):
Project.objects.get(ldt_id=self.project3.ldt_id)
-
\ No newline at end of file
+
+ #test deletion of project with annotations
+ def test_del_project_v2(self):
+
+ self.project4 = Project(title="titleproj3", owner=self.user)
+ self.project4.ldt = '<iri ldtversion="1.0.3" xmlns:dc="http://dublincore.org/documents/dcmi-namespace/"><project id="af3b99e4-b695-11df-bfde-00145ea4a333" user="admin" title="CA:reponse a TC" abstract=""/> <medias> <media extra="" id="laurentcantet_entrelesmurs" pict="" src="http://amateur.iri.centrepompidou.fr//atelier/static/media/ldt/laurentcantet_entrelesmurs/laurentcantet_entrelesmurs.iri" video="rtmp://media.iri.centrepompidou.fr/ddc_player/video/regardssignes/"/> </medias> <annotations> <content id="laurentcantet_entrelesmurs"> <ensemble id="ens_perso" idProject="fe0d5d4c-2201-11df-8a24-00145ea4a2be" title="Decoupages personnels" author="perso" abstract=""> <decoupage id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" author="perso"> <title>CA: prof et admin</title> <abstract/> <elements> <element id="s_442AAB3A-42DA-F9BF-75E7-D2A0663FD5FF" begin="985690" dur="373222" author="" date="2010/09/02" color="16711680" src=""> <title/> <abstract/> <audio source=""/> <tags/> </element> <element id="s_0050F043-3AD2-0A7C-6699-D2A03A1EBA02" begin="5052858" dur="124407" author="" date="2010/09/02" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> <decoupage id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" author="perso"> <title>TC: prof et admin</title> <abstract/> <elements> <element id="s_880D9D4B-8BC0-BA43-5ECA-04EBA9FC9E59" begin="2426894" dur="141478" author="" date="2010/02/25" color="10053375" src=""> <title>Conseil de classe</title> <abstract/> <audio source=""/> <tags> <tag>Argumentation</tag> </tags> </element> <element id="s_D568A57C-7110-DED2-3165-04EC54387060" begin="5052858" dur="124407" author="" date="2010/02/25" color="10053375" src=""> <title>conseil de classe</title> <abstract>Reprise de la figure precedente</abstract> <audio source="undefined"/> <tags/> </element> </elements> </decoupage> </ensemble> </content> </annotations> <displays> <display id="0" title="Init view" idsel="laurentcantet_entrelesmurs" tc="2426424" zoom="0" scroll="0" infoBAB=""> <audio source=""/> <content id="laurentcantet_entrelesmurs"> <decoupage idens="en_2" id="de_PPP" tagsSelect=""/> <decoupage idens="laurentcantet_entrelesmurs" id="c_14A2E638-1936-97DC-E303-2DBA6A82A8B3" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EEEF5C29-86E1-4AAE-E068-04EB5B00E492" tagsSelect=""/> <decoupage idens="ens_perso" id="c_EFC3FFE7-0204-A086-EBEC-D2A03A0E56CB" tagsSelect=""/> </content> </display> </displays> <edits> <editing id="0" tags=""> <title>Bout a bout 1</title> <abstract/> <edit id="edit1" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> <edit id="edit2" tags=""> <eList/> <caption/> <audio/> <mList/> </edit> </editing> </edits> </iri>'
+ self.project4.id = "444"
+ self.project4.ldt_id = str(uuid.uuid1())
+ self.project4.description = "proj4description"
+ self.project4.save()
+
+ create_ldt(self.project4, self.user)
+
+ self.LA = LdtAnnotation(self.project4)
+
+ self.LA.add("id11", "cutting_id", "cutting_title", "title", "text", ["tag1", "tag2"], "800",
+ "10000", "jdoe", "2011-09-10T09:12:58")
+ self.LA.save()
+
+ self.project4.delete()
+
+ with self.assertRaises(Project.DoesNotExist):
+ Project.objects.get(ldt_id=self.project4.ldt_id)
\ No newline at end of file
--- a/src/ldt/ldt/ldt_utils/views/content.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/content.py Mon Dec 03 11:27:35 2012 +0100
@@ -36,7 +36,7 @@
def media_management(request, media_input_type, cleaned_data, content_form, media_form, form_status):
if media_input_type == "none":
- media = None
+ media = None
elif media_input_type == "link":
media = content_form.cleaned_data["media_obj"]
created = False
@@ -46,9 +46,8 @@
cleaned_data['videopath'] = settings.STREAM_URL
# if the source is already http:// or rtmp:// we don't have to add STREAM_URL
if cleaned_data['src'].startswith("rtmp://") or cleaned_data['src'].startswith("http://") or cleaned_data['src'].startswith("https://"):
- cleaned_data['videopath'] = ''
-
- media, created = Media.objects.get_or_create(src=cleaned_data['src'], defaults=cleaned_data) #@UndefinedVariable
+ cleaned_data['videopath'] = ''
+ media, created = Media.objects.get_or_create(src=cleaned_data['src'], defaults=cleaned_data) #@UndefinedVariable
elif media_input_type == "url" or media_input_type == "upload" :
# copy file
@@ -165,7 +164,6 @@
if instance_content:
current_front_project = instance_content.front_project
form_status = 'none'
- errors_transaction = []
if request.method == "POST":
try:
@@ -229,14 +227,8 @@
media_input_type = content_form.cleaned_data["media_input_type"]
-
-
-
media, form_status = media_management(request, media_input_type, cleaned_data, content_form, media_form, form_status)
-
-
-
if form_status != "error":
content_defaults = {}
content_defaults.update(content_form.cleaned_data)
@@ -287,7 +279,7 @@
except Exception, e:
transaction.rollback()
__, value, traceback = sys.exc_info()
- return False, False, False, False, False, errors_transaction, e, traceback
+ return False, False, False, False, False, e, traceback
else:
form_status = 'empty'
@@ -315,18 +307,17 @@
transaction.commit()
except Exception, e:
transaction.rollback()
- errors_transaction.append(e)
- type, value, traceback = sys.exc_info()
- return False, False, False, False, False, errors_transaction, e, traceback
+ __, __, traceback = sys.exc_info()
+ return False, False, False, False, False, e, traceback
- return content_form, media_form, picture_form, form_status, current_front_project, errors_transaction, "", ""
+ return content_form, media_form, picture_form, form_status, current_front_project, "", ""
@login_required
def write_content(request, iri_id=None):
submit_action = request.REQUEST.get("submit_button", False)
member_list = admin_list = []
current_front_project = None
- deleted = None
+ content_deleted = None
if submit_action == "prepare_delete":
errors, titles, message_temp = prepare_delete_content(request, iri_id)
@@ -341,7 +332,7 @@
title_msg = _("confirm delete content")
return render_to_response('ldt/ldt_utils/error_confirm.html', {'errors':errors, 'message':message, 'title': title_msg}, context_instance=RequestContext(request))
elif submit_action == "delete":
- deleted, errors_transaction = delete_content(request, iri_id)
+ content_deleted, e, traceback = delete_content(request, iri_id)
content_form = ContentForm()
form_status = "deleted"
elif submit_action == "prepare_reset":
@@ -370,8 +361,8 @@
elif submit_action=="close":
return redirect("root-view")
else:
- content_form, media_form, picture_form, form_status, current_front_project, errors_transaction, e, traceback = write_content_base(request, iri_id)
- if iri_id:
+ content_form, media_form, picture_form, form_status, current_front_project, e, traceback = write_content_base(request, iri_id)
+ if iri_id:
content_temp = Content.objects.get(iri_id=iri_id)
media_temp = content_temp.media_obj
if media_temp:
@@ -379,11 +370,12 @@
else:
member_list, admin_list = get_userlist_model(content_temp, request.user)
- # Deleted is False if an error occurred during deletion
- if (deleted == False) or (content_form == False and media_form == False and picture_form == False and form_status == False and current_front_project == False):
- message=_("An error occurred - Please try again or contact webmaster")
- title = _("Error")
- logging.error(e)
+ if (content_form == False and media_form == False and picture_form == False and form_status == False and current_front_project == False):
+ message=_("An error occurred - Please try again or contact webmaster")
+ title = _("Error")
+ raise e, None, traceback
+
+ if content_deleted == False:
raise e, None, traceback
if iri_id:
@@ -454,20 +446,18 @@
except Exception, e:
content.rollback()
transaction.rollback()
- errors_transaction.append(_("Content deletion failure"))
- errors_transaction.append(e)
- return False, errors_transaction
+ __, __, traceback = sys.exc_info()
+ return False, e, traceback
else:
try:
transaction.commit()
content.commit()
- return True, errors_transaction
- except:
+ return True, "", ""
+ except Exception, e:
content.rollback()
transaction.rollback()
- errors_transaction.append(_("Commit of the content deletion failed"))
- errors_transaction.append(e)
- return False, errors_transaction
+ __, __, traceback = sys.exc_info()
+ return False, e, traceback
def upload(request):
if request.method == 'POST':
--- a/src/ldt/ldt/management/commands/initsitedomain.py Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/management/commands/initsitedomain.py Mon Dec 03 11:27:35 2012 +0100
@@ -11,8 +11,11 @@
def handle(self, *args, **options):
site = Site.objects.get(id=settings.SITE_ID)
web_url = settings.WEB_URL
- domain_area = web_url.split("//",1)
- domain = domain_area[1]
+ if (web_url.startswith("http://")):
+ domain_area = web_url.split("//",1)
+ domain = domain_area[1]
+ else:
+ domain=web_url
if site.domain!=domain:
site.domain = domain
site.save()
--- a/src/ldt/ldt/static/ldt/metadataplayer/KnowledgeConcierge.js Fri Nov 30 11:51:56 2012 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/KnowledgeConcierge.js Mon Dec 03 11:27:35 2012 +0100
@@ -324,7 +324,7 @@
var keywmatch = document.location.hash.match(/keyword=([^#?&]+)/);
if (keywmatch) {
this.player.on("widgets-loaded", function() {
- triggerSearch(keywmatch[1]);
+ triggerSearch(decodeURIComponent(keywmatch[1]));
})
}