# HG changeset patch # User cavaliet # Date 1412239064 -7200 # Node ID 34ad53eecb18dde2ffddcec67bb45f899259c72e # Parent 9ea9abf462fe8376bf02f2ffdfa7317bdf2824ad v0.6.2 : enhance libadvene export diff -r 9ea9abf462fe -r 34ad53eecb18 src/spel/__init__.py --- a/src/spel/__init__.py Wed Oct 01 17:15:49 2014 +0200 +++ b/src/spel/__init__.py Thu Oct 02 10:37:44 2014 +0200 @@ -1,4 +1,4 @@ -VERSION = (0, 6, 1, "final", 0) +VERSION = (0, 6, 2, "final", 0) VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION[:2]))) diff -r 9ea9abf462fe -r 34ad53eecb18 src/spel/views.py --- a/src/spel/views.py Wed Oct 01 17:15:49 2014 +0200 +++ b/src/spel/views.py Thu Oct 02 10:37:44 2014 +0200 @@ -502,17 +502,18 @@ project = get_object_or_404(Project, ldt_id=id) ps = ProjectJsonSerializer(project) project_dict = ps.serialize_to_cinelab() - p = Package("http://spectacleenligne.fr", create=True) + p = Package("http://spectacleenlignes.fr" + request.path, create=True) Parser.parse_into(project_dict, p) - outfile = "/tmp/" + unicode(uuid.uuid1()) - filedata = "" - if format == "rdf": - serialize_to_rdf(p, outfile) - elif format == "ttl": - serialize_to_ttl(p, outfile) - with open(outfile, "r") as myfile: - filedata = myfile.read() - return HttpResponse(filedata, content_type="text/plain") + + if format=="rdf": + content_type = "application/rdf+xml" + serialize_method= serialize_to_rdf + elif format=="ttl": + content_type = "text/turtle" + serialize_method= serialize_to_ttl + resp = HttpResponse(content_type=content_type) + serialize_method(p, resp) + return resp return project_json_id(request, id) \ No newline at end of file