--- a/src/ldt/ldt/ldt_utils/views/lignesdetemps.py Mon Apr 08 17:24:42 2013 +0200
+++ b/src/ldt/ldt/ldt_utils/views/lignesdetemps.py Fri Apr 12 18:14:06 2013 +0200
@@ -10,6 +10,7 @@
from ldt.ldt_utils.stat import update_stat_project
from ldt.ldt_utils.utils import LdtUtils, clean_description
from ldt.security.utils import set_forbidden_stream
+from ldt.security.permissionchecker import check_object_perm_for_user
from ldt.utils.projectldt_parser import absolute_src_xml, relative_src_xml
from ldt.utils.url import absstatic, absurl
from ldt.utils.web_url_management import get_web_url
@@ -195,16 +196,16 @@
except Project.DoesNotExist:
return HttpResponseRedirect(reverse("ldt.ldt_utils.views.workspace.home"))
- if ldt.state == 2 or not request.user.has_perm('change_project', ldt): #published
+ if ldt.state == 2 or not check_object_perm_for_user(ldt, 'change_project', request.user):
readonly = 'true'
else:
readonly = 'false'
-
+
if full:
template_path = 'ldt/ldt_utils/init_ldt_full.html'
else:
template_path = 'ldt/ldt_utils/init_ldt.html'
-
+
return render_to_response(template_path, {'colorurl': colorurl, 'i18nurl': i18nurl, 'language': language_code, 'baseurl': baseurl, 'url': urlStr, 'posturl': posturl, 'id': id, 'readonly': readonly}, context_instance=RequestContext(request))
@@ -214,7 +215,7 @@
doc = ldtgen.generate_init([url], 'ldt.ldt_utils.views.lignesdetemps.' + method, None)
library = doc.xpath('/iri/files/library')[0]
- for c in Content.safe_objects.all():
+ for c in Content.safe_objects.all().select_related("media_obj"):
elem = lxml.etree.SubElement(library, 'file')
elem.set('src', c.iri_url())
if c.videopath :
@@ -302,20 +303,20 @@
#remove html tags added by flash
description = ldtproject.get_description(doc)
new_desc = clean_description(description)
-
+
if new_desc:
desc_node = doc.xpath('/iri/project')[0]
desc_node.set('abstract', new_desc)
ldtproject.ldt = lxml.etree.tostring(doc, pretty_print=True)
-
+
ldtproject.description = new_desc if new_desc else description
#set a new icon for this project
if check_icon_project:
ldtproject.set_icon()
-
+
ldtproject.save()
-
+
else:
ldt = ''
new_contents = []