[saem-devel] [PATCH 02 of 10] [rdf] Add selector so view isn't selectable if element isn't adaptable to underlying adapter

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Jan 31 09:49:07 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1485776196 -3600
#      Mon Jan 30 12:36:36 2017 +0100
# Node ID 003f5d00dc408155814b1c809c1bfbb3eee07b88
# Parent  4f5d97029ef38e7563c85b924a55bb018a5929ae
[rdf] Add selector so view isn't selectable if element isn't adaptable to underlying adapter

diff --git a/cubicweb_saem_ref/views/rdf.py b/cubicweb_saem_ref/views/rdf.py
--- a/cubicweb_saem_ref/views/rdf.py
+++ b/cubicweb_saem_ref/views/rdf.py
@@ -13,20 +13,23 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 """cubicweb-saem-ref RDF views"""
 
+from cubicweb.predicates import adaptable
 from cubicweb.web.views import VID_BY_MIMETYPE, rdf
 
 
 VID_BY_MIMETYPE['application/rdf+xml'] = 'rdf'
 
 
 class SAEMRDFView(rdf.RDFView):
     """Override cw's rdf view to dispatch to primary.rdf / list.rdf views, as implemented in the
     skos cube.
     """
+    __select__ = adaptable('RDFPrimary')
+
     def call(self):
         vid = 'primary.rdf' if len(self.cw_rset) == 1 else 'list.rdf'
         self.wview(vid, self.cw_rset)
 
 


More information about the saem-devel mailing list