# HG changeset patch # User Sylvain Thénault # Date 1286550466 -7200 # Node ID c560f8d9faeee8a409a39447d47e3ec1ed4f6015 # Parent c07c42a81075d244bd972d509e58eba52351448b [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 diff -r c07c42a81075 -r c560f8d9faee web/component.py --- 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