small correction on merge project, superuser see all projects
authorymh <ymh.work@gmail.com>
Fri, 06 Mar 2015 17:10:45 +0100
changeset 1339 f0115266e5d3
parent 1338 f2238474269d
child 1340 82c64953ea3b
small correction on merge project, superuser see all projects
src/ldt/ldt/ldt_utils/projectserializer.py
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html
src/ldt/ldt/settings.py
virtualenv/res/lib/lib_create_env.py
--- a/src/ldt/ldt/ldt_utils/projectserializer.py	Fri Jan 30 15:16:45 2015 +0100
+++ b/src/ldt/ldt/ldt_utils/projectserializer.py	Fri Mar 06 17:10:45 2015 +0100
@@ -734,7 +734,12 @@
             p_xml = lxml.etree.fromstring(p.ldt_encoded)
             # We only keep the decoupages (cuttings) visible in the default view, which means the first display.
             first_display = p_xml.xpath('/iri/displays/display')[0]
-            current_disp_node = first_display.xpath('content[@id="' + self.content.iri_id + '"]')[0]
+            disp_node_list = first_display.xpath('content[@id="' + self.content.iri_id + '"]')
+            if len(disp_node_list) == 0:
+                # project seems broken passing
+                logger.info("Get merged project : this project display %s does not contains the content %s", p.ldt_id, self.content.iri_id)
+                continue
+            current_disp_node = disp_node_list[0]
             # First version of ensemble
             ens = p_xml.xpath('/iri/annotations/content[@id="' + self.content.iri_id + '"]/ensemble')
             for e in ens:
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html	Fri Jan 30 15:16:45 2015 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html	Fri Mar 06 17:10:45 2015 +0100
@@ -14,7 +14,11 @@
 <script type="text/javascript">
 
 var content_filter_url = "{% url 'ldt.ldt_utils.views.content.contents_filter' filter_c='__FILTER__' %}";
+{% if request.user.is_superuser %}
+var project_filter_url = "{% url 'ldt.ldt_utils.views.project.projects_filter' filter='__FILTER__' is_owner='false' status='0' %}";
+{% else %}
 var project_filter_url = "{% url 'ldt.ldt_utils.views.project.projects_filter' filter='__FILTER__' is_owner='true' status='0' %}";
+{% endif %}
 var publish_project_url = "{% url 'ldt.ldt_utils.views.project.publish' id='__PROJECT_ID__' %}";
 var unpublish_project_url = "{% url 'ldt.ldt_utils.views.project.unpublish' id='__PROJECT_ID__' %}";
 
--- a/src/ldt/ldt/settings.py	Fri Jan 30 15:16:45 2015 +0100
+++ b/src/ldt/ldt/settings.py	Fri Mar 06 17:10:45 2015 +0100
@@ -30,6 +30,7 @@
     'ldt.indexation',
     'oauth_provider',
     'django_openid_consumer',
+    'corsheaders',
     'social_auth',
     'south',
     'guardian',
@@ -40,6 +41,7 @@
 
 MIDDLEWARE_CLASSES = getattr(settings, 'MIDDLEWARE_CLASSES', (
     'django.middleware.cache.UpdateCacheMiddleware',
+    'corsheaders.middleware.CorsMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.cache.FetchFromCacheMiddleware',
     'ldt.ldt_utils.middleware.swfupload.SWFUploadMiddleware',
--- a/virtualenv/res/lib/lib_create_env.py	Fri Jan 30 15:16:45 2015 +0100
+++ b/virtualenv/res/lib/lib_create_env.py	Fri Mar 06 17:10:45 2015 +0100
@@ -49,6 +49,7 @@
     'PYYAML' : {'setup':'pyyaml', 'url':'http://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz', 'local': 'PyYAML-3.10.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
     'PYTHON-DIGEST' : {'setup':'python-digest', 'url':'http://pypi.python.org/packages/source/p/python-digest/python-digest-1.7.tar.gz', 'local': 'python-digest-1.7.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
     'DJANGO-TASTYPIE' : {'setup':'django-tastypie', 'url':'django-tastypie-0.9.11-modified.tar.gz', 'local': 'django-tastypie-0.9.11-modified.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
+    'DJANGO-CORS-HEADERS' : {'setup':'django-cors-headers', 'url':'https://github.com/ottoyiu/django-cors-headers/archive/1.0.0.tar.gz', 'local': '1.0.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
 }
 
 if system_str == 'Windows':