[web/views] set the right inheritance

These views shall inherite from View instead of EntityView as they do not use entity_call and rewrite __select__.

This also fix NotImplementedError when using self.wview(vid, entity=entity) which call entity_call instead of cell_call.

authorAlain Leufroy <alain@leufroy.fr>
changeset2375e9aff575
branchdefault
phasedraft
hiddenyes
parent revision#480187dd66b3 [web] move AbstractAuthManager near its immediate concrete subclass
child revision#244f9c128216 [web/views] respect the ``EntityView`` API for related subclasses
files modified by this revision
web/views/editviews.py
web/views/timetable.py
web/views/treeview.py
# HG changeset patch
# User Alain Leufroy <alain@leufroy.fr>
# Date 1431185958 -7200
# Sat May 09 17:39:18 2015 +0200
# Node ID 2375e9aff575ea3c17c49d3a620c8104901ed7e5
# Parent 480187dd66b3c5b0eebe922e9cba8d4f3a34efaa
[web/views] set the right inheritance

These views shall inherite from ``View`` instead of ``EntityView`` as they
do not use ``entity_call`` and rewrite ``__select__``.

This also fix NotImplementedError when using ``self.wview(vid,
entity=entity)`` which call ``entity_call`` instead of ``cell_call``.

diff --git a/web/views/editviews.py b/web/views/editviews.py
@@ -21,18 +21,18 @@
1  _ = unicode
2 
3  from logilab.common.decorators import cached
4  from logilab.mtconverter import xml_escape
5 
6 -from cubicweb.view import EntityView, StartupView
7 +from cubicweb.view import View, EntityView, StartupView
8  from cubicweb.predicates import (one_line_rset, non_final_entity,
9                                   match_search_state)
10  from cubicweb.web import httpcache
11  from cubicweb.web.views import baseviews, linksearch_select_url
12 
13 
14 -class SearchForAssociationView(EntityView):
15 +class SearchForAssociationView(View):
16      """view called by the edition view when the user asks to search for
17      something to link to the edited eid
18      """
19      __regid__ = 'search-associate'
20      __select__ = (one_line_rset() & match_search_state('linksearch')
diff --git a/web/views/timetable.py b/web/views/timetable.py
@@ -22,11 +22,11 @@
21 
22  from logilab.mtconverter import xml_escape
23  from logilab.common.date import ONEDAY, date_range, todatetime
24 
25  from cubicweb.predicates import adaptable
26 -from cubicweb.view import EntityView
27 +from cubicweb.view import View
28 
29 
30  class _TaskEntry(object):
31      def __init__(self, task, color, column):
32          self.task = task
@@ -35,11 +35,11 @@
33          self.lines = 1
34 
35  MIN_COLS = 3  # minimum number of task columns for a single user
36  ALL_USERS = object()
37 
38 -class TimeTableView(EntityView):
39 +class TimeTableView(View):
40      __regid__ = 'timetable'
41      title = _('timetable')
42      __select__ = adaptable('ICalendarable')
43      paginable = False
44 
diff --git a/web/views/treeview.py b/web/views/treeview.py
@@ -26,11 +26,11 @@
45 
46  from logilab.mtconverter import xml_escape
47 
48  from cubicweb.utils import make_uid, json
49  from cubicweb.predicates import adaptable
50 -from cubicweb.view import EntityView
51 +from cubicweb.view import View, EntityView
52  from cubicweb.web.views import baseviews
53  from cubicweb.web.views.ajaxcontroller import ajaxfunc
54 
55  def treecookiename(treeid):
56      return str('%s-treestate' % treeid)
@@ -84,11 +84,11 @@
57          self.w(u'<li class="%s">\n' % entity.cw_etype.lower())
58      def close_item(self, entity):
59          self.w(u'</li>\n')
60 
61 
62 -class TreePathView(EntityView):
63 +class TreePathView(View):
64      """a recursive path view"""
65      __regid__ = 'path'
66      __select__ = adaptable('ITree')
67      item_vid = 'oneline'
68      separator = u'&#160;&gt;&#160;'