[PATCH 07 of 14 skos] Drop compat for cubicweb < 3.21 in primary.rdf view

Denis Laxalde denis.laxalde at logilab.fr
Mon Feb 19 12:27:58 CET 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1519030637 -3600
#      Mon Feb 19 09:57:17 2018 +0100
# Node ID d5c863702627862ab49196f8659c878f75828e9f
# Parent  ee776bbaca2ff25d8e9bdfb3e38705e078c21ecd
Drop compat for cubicweb < 3.21 in primary.rdf view

Related to #17133718.

diff --git a/views/rdf.py b/views/rdf.py
--- a/views/rdf.py
+++ b/views/rdf.py
@@ -17,9 +17,6 @@
 
 from io import BytesIO
 
-from six import text_type
-
-from cubicweb.__pkginfo__ import numversion
 from cubicweb.predicates import adaptable
 from cubicweb.view import EntityView
 
@@ -35,7 +32,7 @@ class RDFPrimaryView(EntityView):
     __select__ = EntityView.__select__ & adaptable(adapter)
     templatable = False
     content_type = 'application/rdf+xml'
-    binary = numversion >= (3, 21)
+    binary = True
 
     def call(self):
         graph = default_graph()
@@ -52,19 +49,10 @@ class RDFPrimaryView(EntityView):
         if dump:
             self._dump(graph)
 
-    if binary:
-
-        def _dump(self, graph):
-            fobj = BytesIO()
-            graph.dump(fobj, rdf_format='xml')
-            self.w(fobj.getvalue())
-
-    else:
-
-        def _dump(self, graph):
-            fobj = BytesIO()
-            graph.dump(fobj, rdf_format='xml')
-            self.w(text_type(fobj.getvalue(), 'utf-8'))
+    def _dump(self, graph):
+        fobj = BytesIO()
+        graph.dump(fobj, rdf_format='xml')
+        self.w(fobj.getvalue())
 
 
 class RDFListView(RDFPrimaryView):



More information about the saem-devel mailing list