--- a/.hgtags Thu Jun 10 19:16:58 2010 +0200
+++ b/.hgtags Thu Jun 10 19:01:46 2010 +0200
@@ -1,1 +1,2 @@
65e914ac91c87678892bb29cbdfa39ace3aa3183 V00.01
+b3692a42ac798d6752d8efeb5eeb7ded0f4de295 V00.02
--- a/web/eulalie/__init__.py Thu Jun 10 19:16:58 2010 +0200
+++ b/web/eulalie/__init__.py Thu Jun 10 19:01:46 2010 +0200
@@ -1,4 +1,4 @@
-VERSION = (0,1)
+VERSION = (0,2)
VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION)))
--- a/web/eulalie/config.py.tmpl Thu Jun 10 19:16:58 2010 +0200
+++ b/web/eulalie/config.py.tmpl Thu Jun 10 19:01:46 2010 +0200
@@ -61,3 +61,4 @@
REGISTRATION_OPEN = False
LDT_MAX_SEARCH_NUMBER = 50
+LDT_JSON_DEFAULT_INDENT = 2
--- a/web/eulalie/settings.py Thu Jun 10 19:16:58 2010 +0200
+++ b/web/eulalie/settings.py Thu Jun 10 19:01:46 2010 +0200
@@ -126,12 +126,16 @@
"__MACOSX",
)
+LDT_JSON_DEFAULT_INDENT
+ACCOUNT_ACTIVATION_DAYS = 7
+
+LDT_MAX_SEARCH_NUMBER = 50
+LDT_JSON_DEFAULT_INDENT = 2
+
+
from config import *
LOGIN_URL = BASE_URL + 'eulalie/accounts/login/'
LOGOUT_URL = BASE_URL + 'eulalie'
-ACCOUNT_ACTIVATION_DAYS = 7
-
-LDT_MAX_SEARCH_NUMBER = 50
--- a/web/ldt/ldt_utils/models.py Thu Jun 10 19:16:58 2010 +0200
+++ b/web/ldt/ldt_utils/models.py Thu Jun 10 19:01:46 2010 +0200
@@ -2,7 +2,7 @@
from django.conf import settings
from ldt.core.models import Document, Owner
from django.utils.translation import ugettext_lazy as _
-from utils import create_ldt, copy_ldt, create_iri
+from utils import create_ldt, copy_ldt, create_empty_iri
import os
import os.path
import uuid
@@ -50,13 +50,18 @@
def save(self):
# create iri file if needed
- iri_file_path = self.iri_file_path()
- if not os.path.exists(iri_file_path):
- dir = os.path.dirname(iri_file_path)
- if not os.path.exists(dir):
- os.makedirs(dir)
- file = open(iri_file_path,"w")
- create_iri(file, self, "IRI")
+ try:
+ iri_file_path = self.iri_file_path()
+ if not os.path.exists(iri_file_path):
+ dir = os.path.dirname(iri_file_path)
+ if not os.path.exists(dir):
+ os.makedirs(dir)
+ file = open(iri_file_path,"w")
+ create_empty_iri(file, self, "IRI")
+ except Exception, e:
+ if os.path.exists(iri_file_path):
+ os.remove(iri_file_path)
+ raise e
# update it
super(Content, self).save()
--- a/web/ldt/ldt_utils/templates/ldt/ldt_utils/ldt_list.html Thu Jun 10 19:16:58 2010 +0200
+++ b/web/ldt/ldt_utils/templates/ldt/ldt_utils/ldt_list.html Thu Jun 10 19:01:46 2010 +0200
@@ -2,8 +2,6 @@
{# list of projects ldt #}
{%load i18n %}
{% block js_import %}{{ block.super }}
-<script type="text/javascript"
- src="{{ BASE_URL }}static/js/jquery.DOMwindow.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.ldt_link').nyroModal({
--- a/web/ldt/ldt_utils/utils.py Thu Jun 10 19:16:58 2010 +0200
+++ b/web/ldt/ldt_utils/utils.py Thu Jun 10 19:01:46 2010 +0200
@@ -267,7 +267,7 @@
new_project.save()
return new_project
-def create_iri(file, content, username):
+def create_empty_iri(file, content, username):
writer = MarkupWriter(file, indent = u"yes")
writer.startDocument()
@@ -288,36 +288,6 @@
writer.startElement(u"body")
writer.startElement(u"ensembles")
- ensemble_id = unicode(uuid.uuid1())
- writer.startElement(u"ensemble",
- attributes = {
- u'label':u'undefined',
- u'date':unicode(datetime.date.today().isoformat()),
- u'title':u'autogenerated',
- u'abstract':u'auto generated',
- u'id':ensemble_id,
- u'author':unicode(username)
- })
- decoupage_id = unicode(uuid.uuid1())
- writer.startElement(u"decoupage",
- attributes = {
- u'height' : u'10',
- u'dur':unicode(content.duration),
- u'type':u'regular',
- u'date':unicode(datetime.date.today().isoformat()),
- u'id':decoupage_id,
- u'author':unicode(username)
- })
-
- writer.startElement(u"title")
- writer.text(u'autogenerated')
- writer.endElement(u"title")
- writer.startElement(u"abstract")
- writer.text(u'autogenerated')
- writer.endElement(u"abstract")
-
- writer.endElement(u"decoupage")
- writer.endElement(u"ensemble")
writer.endElement(u"ensembles")
writer.simpleElement(u'links')
@@ -333,9 +303,8 @@
writer.endElement(u"medias")
- writer.startElement(u'display')
- writer.simpleElement(u'decoupage', attributes={u'position':u'1', u'id':decoupage_id, u'idensemble':ensemble_id})
- writer.endElement(u'display')
+ #writer.startElement(u'display', attributes={u'id':unicode(uuid.uuid1()), u'title':u"default", u"idsel":unicode(content.iri_id), u"tc":u"0", u"zoom":u"0", u"scroll":u"0", u"infoBAB":u""})
+ writer.simpleElement(u'display')
writer.endElement(u"body")
--- a/web/ldt/ldt_utils/views.py Thu Jun 10 19:16:58 2010 +0200
+++ b/web/ldt/ldt_utils/views.py Thu Jun 10 19:01:46 2010 +0200
@@ -203,14 +203,31 @@
def project_json(request, project):
- resp = HttpResponse(mimetype="application/json; charset=utf-8")
+ mimetype = request.REQUEST.get("mimetype")
+ if mimetype is None:
+ mimetype = u"application/json; charset=utf-8"
+
+ resp = HttpResponse(mimetype=mimetype)
resp['Cache-Control']='no-cache, must-revalidate'
resp['Pragma']='no-cache'
+ indent = request.REQUEST.get("indent")
+ if indent is None:
+ indent = settings.LDT_JSON_DEFAULT_INDENT
+ else:
+ indent = int(indent)
+
+ callback = request.REQUEST.get("callback")
+
ps = ProjectSerializer(project)
project_dict = ps.serialize_to_cinelab()
- simplejson.dump(project_dict, resp, ensure_ascii=False, indent=2)
+ json_str = simplejson.dumps(project_dict, ensure_ascii=False, indent=indent)
+
+ if callback is not None:
+ json_str = "%s(%s)" % (callback,json_str)
+
+ resp.write(json_str)
return resp
--- a/web/ldt/settings.py Thu Jun 10 19:16:58 2010 +0200
+++ b/web/ldt/settings.py Thu Jun 10 19:01:46 2010 +0200
@@ -27,6 +27,7 @@
ACCOUNT_ACTIVATION_DAYS = getattr(settings, 'ACCOUNT_ACTIVATION_DAYS', 7)
LDT_MEDIA_PREFIX = getattr(settings, 'LDT_MEDIA_PREFIX', MEDIA_URL + 'ldt/')
LDT_MAX_SEARCH_NUMBER = 50
+LDT_JSON_DEFAULT_INDENT = 2