cubicweb/view.py
changeset 12831 b1ef9690f357
parent 12780 8caa109dfe94
child 12846 ba3cf6aaa695
--- a/cubicweb/view.py	Thu Dec 19 06:32:16 2019 +0100
+++ b/cubicweb/view.py	Thu Dec 19 06:33:49 2019 +0100
@@ -22,11 +22,12 @@
 
 import re
 from io import BytesIO
+from typing import Union
 from warnings import warn
 from functools import partial
 from inspect import getframeinfo, stack
 
-from logilab.common.registry import yes
+from logilab.common.registry import yes, Predicate
 from logilab.mtconverter import xml_escape
 
 from rql import nodes
@@ -358,7 +359,7 @@
 
 class EntityView(View):
     """base class for views applying on an entity (i.e. uniform result set)"""
-    __select__ = non_final_entity()
+    __select__: Union[None, str, Predicate] = non_final_entity()
     category = _('entityview')
 
     def call(self, **kwargs):
@@ -390,7 +391,7 @@
     """base class for views which doesn't need a particular result set to be
     displayed (so they can always be displayed!)
     """
-    __select__ = none_rset()
+    __select__: Union[None, str, Predicate] = none_rset()
 
     category = _('startupview')
 
@@ -407,7 +408,7 @@
     """base class for entity views which may also be applied to None
     result set (usually a default rql is provided by the view class)
     """
-    __select__ = none_rset() | non_final_entity()
+    __select__: Union[None, str, Predicate] = none_rset() | non_final_entity()
 
     default_rql = None
 
@@ -441,7 +442,7 @@
 
 class AnyRsetView(View):
     """base class for views applying on any non empty result sets"""
-    __select__ = nonempty_rset()
+    __select__: Union[None, str, Predicate] = nonempty_rset()
 
     category = _('anyrsetview')
 
@@ -541,7 +542,7 @@
 class Component(ReloadableMixIn, View):
     """base class for components"""
     __registry__ = 'components'
-    __select__ = yes()
+    __select__: Union[None, str, Predicate] = yes()
 
     # XXX huummm, much probably useless (should be...)
     htmlclass = 'mainRelated'