[pre 3.10 compat] if CtxComponent as a call() method, emit a deprecation warning but use it. Also ensure default value on class for visible and order, and define wview for bw compat as well
--- a/web/component.py Fri Oct 08 16:11:37 2010 +0200
+++ b/web/component.py Fri Oct 08 17:07:46 2010 +0200
@@ -22,6 +22,8 @@
__docformat__ = "restructuredtext en"
_ = unicode
+from warnings import warn
+
from logilab.common.deprecation import class_deprecated, class_renamed
from logilab.mtconverter import xml_escape
@@ -221,6 +223,8 @@
_('ctxtoolbar')),
help=_('context where this component should be displayed')),
}
+ visible = True
+ order = 0
context = 'left'
contextual = False
title = None
@@ -228,6 +232,15 @@
# XXX support kwargs for compat with old boxes which gets the view as
# argument
def render(self, w, **kwargs):
+ if hasattr(self, 'call'):
+ warn('[3.10] should not anymore implements call on %s, see new CtxComponent api'
+ % self.__class__, DeprecationWarning)
+ self.w = w
+ def wview(__vid, rset=None, __fallback_vid=None, **kwargs):
+ self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs)
+ self.wview = wview
+ self.call(**kwargs)
+ return
getlayout = self._cw.vreg['components'].select
try:
# XXX ensure context is given when the component is reloaded through