[views/gallery] cw 3.15 compat (closes #2502739)

authorAurelien Campeas <aurelien.campeas@logilab.fr>
changeset4048d532e82e
branchdefault
phasepublic
hiddenno
parent revision#03ffa0cc258f [merge] backport stable
child revision#944709726157 [views/gallery] fix selector ambig?ity (likely introduced by cw 3.15), closes #2517078
files modified by this revision
views/gallery.py
# HG changeset patch
# User Aurelien Campeas <aurelien.campeas@logilab.fr>
# Date 1349959163 -7200
# Thu Oct 11 14:39:23 2012 +0200
# Node ID 4048d532e82e2351a384eff05544f4b7478d71f8
# Parent 03ffa0cc258fcfe81a07689ebd3dff773c686c27
[views/gallery] cw 3.15 compat (closes #2502739)

diff --git a/views/gallery.py b/views/gallery.py
@@ -1,9 +1,9 @@
1  """file/image gallery view
2 
3  :organization: Logilab
4 -:copyright: 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5 +:copyright: 2006-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
6  :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
7  """
8 
9  __docformat__ = "restructuredtext en"
10  _ = unicode
@@ -12,11 +12,11 @@
11  from logilab.common.decorators import monkeypatch
12 
13  from cubicweb import typed_eid
14  from cubicweb.view import EntityView
15  from cubicweb.selectors import is_instance, has_mimetype, adaptable
16 -from cubicweb.web.views.basecontrollers import JSonController, xhtmlize
17 +from cubicweb.web.views import ajaxcontroller
18 
19  class GalleryView(EntityView):
20      __regid__ = 'gallery'
21      __select__ = is_instance('File')
22 
@@ -55,12 +55,11 @@
23               self.w(u'<a href="javascript:displayImg(%(eid)s)" title="%(title)s"><img id="img%(eid)s" '
24                      'alt="%(title)s" src="%(icon)s"/></a>'
25                 % {'eid':entity.eid, 'title':title,'icon':icon})
26 
27 
28 -@monkeypatch(JSonController)
29 -@xhtmlize
30 +@ajaxcontroller.ajaxfunc(output_type='xhtml')
31  def js_get_image(self, eid):
32      return self._cw.view('primary', self._cw.eid_rset(eid), row=0, col=0,
33                           initargs={'is_primary': False})
34 
35