view.py
changeset 4252 6c4f109c2b03
parent 4181 c79135c217df
parent 4244 2c3de1953d00
child 4459 f628abfb3a6c
equal deleted inserted replaced
4251:3c6569be1f86 4252:6c4f109c2b03
     1 """abstract views and templates classes for CubicWeb web client
     1 """abstract views and templates classes for CubicWeb web client
     2 
     2 
     3 
     3 
     4 :organization: Logilab
     4 :organization: Logilab
     5 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     5 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     7 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     7 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     8 """
     8 """
     9 __docformat__ = "restructuredtext en"
     9 __docformat__ = "restructuredtext en"
    10 _ = unicode
    10 _ = unicode
    11 
    11 
    12 from cStringIO import StringIO
    12 from cStringIO import StringIO
       
    13 from warnings import warn
    13 
    14 
    14 from simplejson import dumps
    15 from simplejson import dumps
    15 
    16 
    16 from logilab.common.deprecation import deprecated
    17 from logilab.common.deprecation import deprecated
    17 from logilab.mtconverter import xml_escape
    18 from logilab.mtconverter import xml_escape
    95     time to a write function to use.
    96     time to a write function to use.
    96     """
    97     """
    97     __registry__ = 'views'
    98     __registry__ = 'views'
    98 
    99 
    99     templatable = True
   100     templatable = True
   100     need_navigation = True
       
   101     # content_type = 'application/xhtml+xml' # text/xhtml'
   101     # content_type = 'application/xhtml+xml' # text/xhtml'
   102     binary = False
   102     binary = False
   103     add_to_breadcrumbs = True
   103     add_to_breadcrumbs = True
   104     category = 'view'
   104     category = 'view'
       
   105 
       
   106     @property
       
   107     @deprecated('[3.6] need_navigation is deprecated, use .paginable')
       
   108     def need_navigation(self):
       
   109         return True
       
   110 
       
   111     @property
       
   112     def paginable(self):
       
   113         if not isinstance(self.__class__.need_navigation, property):
       
   114             warn('[3.6] %s.need_navigation is deprecated, use .paginable'
       
   115                  % self.__class__, DeprecationWarninig)
       
   116             return self.need_navigation
       
   117         return True
   105 
   118 
   106     def __init__(self, req=None, rset=None, **kwargs):
   119     def __init__(self, req=None, rset=None, **kwargs):
   107         super(View, self).__init__(req, rset=rset, **kwargs)
   120         super(View, self).__init__(req, rset=rset, **kwargs)
   108         self.w = None
   121         self.w = None
   109 
   122