[saem-devel] [PATCH 09 of 10] [eac] Use cache friendly rql query

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


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1485812159 -3600
#      Mon Jan 30 22:35:59 2017 +0100
# Node ID 0381e47592b71f4d5aa0a3697bdb631d2edf70cb
# Parent  990aaa03df44bd390cb32a9d32a161d887e2a427
[eac] Use cache friendly rql query

diff --git a/cubicweb_saem_ref/views/authorityrecord.py b/cubicweb_saem_ref/views/authorityrecord.py
--- a/cubicweb_saem_ref/views/authorityrecord.py
+++ b/cubicweb_saem_ref/views/authorityrecord.py
@@ -886,11 +886,12 @@ class AuthorityRecordGraphView(EntityVie
         self._cw.add_js(('jquery.js', 'jquery.jOrgChart.js'))
         self._cw.add_css('jquery.jOrgChart.css')
         hiera_list = u'<ul id="hierarchical_relations" style="display:none">'
         tags_closure = u'</ul>'
         rset_parents = self._cw.execute('Any P, PR WHERE PR hierarchical_child X, '
-                                        'PR hierarchical_parent P, X eid %s' % entity.eid)
+                                        'PR hierarchical_parent P, X eid %(eid)s',
+                                        {'eid': entity.eid})
         if rset_parents:
             parent = rset_parents.get_entity(0, 0)
             parent_rel = rset_parents.get_entity(0, 1)
             nprops = _node(parent, parent_rel)
             hiera_list += u'<li>' + _add_html_node_content(nprops) + u'<ul>'


More information about the saem-devel mailing list