[web/views] add text/n3 rdf view
authorJulien Cristau <julien.cristau@logilab.fr>
Fri, 20 Feb 2015 16:17:51 +0100
changeset 10317 b81adb5e32f9
parent 10316 4ce8b8437838
child 10318 09273cb083e7
[web/views] add text/n3 rdf view Less shit than xml.
web/views/rdf.py
--- a/web/views/rdf.py	Fri Oct 31 17:17:26 2014 +0100
+++ b/web/views/rdf.py	Fri Feb 20 16:17:51 2015 +0100
@@ -47,6 +47,8 @@
         __regid__ = 'rdf'
         title = _('rdf export')
         templatable = False
+        binary = True
+        format = 'xml'
         content_type = 'text/xml' # +rdf
 
         def call(self):
@@ -57,7 +59,7 @@
             for i in xrange(self.cw_rset.rowcount):
                 entity = self.cw_rset.complete_entity(i, 0)
                 self.entity2graph(graph, entity)
-            self.w(graph.serialize().decode('utf-8'))
+            self.w(graph.serialize(format=self.format))
 
         def entity_call(self, entity):
             self.call()
@@ -100,3 +102,8 @@
                             else:
                                 add( (URIRef(related.cwuri), CW[rtype], cwuri) )
 
+
+    class RDFN3View(RDFView):
+        __regid__ = 'n3rdf'
+        format = 'n3'
+        content_type = 'text/n3'