web/views/basetemplates.py
changeset 8190 2a3c1b787688
parent 8009 75638a6ff159
child 8307 8be58694f416
equal deleted inserted replaced
8189:2ee0ef069fa7 8190:2a3c1b787688
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    20 __docformat__ = "restructuredtext en"
    20 __docformat__ = "restructuredtext en"
    21 _ = unicode
    21 _ = unicode
    22 
    22 
    23 from logilab.mtconverter import xml_escape
    23 from logilab.mtconverter import xml_escape
    24 from logilab.common.deprecation import class_renamed
    24 from logilab.common.deprecation import class_renamed
    25 
    25 from logilab.common.registry import objectify_predicate
    26 from cubicweb.appobject import objectify_selector
    26 
    27 from cubicweb.selectors import match_kwargs, no_cnx, anonymous_user
    27 from cubicweb.predicates import match_kwargs, no_cnx, anonymous_user
    28 from cubicweb.view import View, MainTemplate, NOINDEX, NOFOLLOW, StartupView
    28 from cubicweb.view import View, MainTemplate, NOINDEX, NOFOLLOW, StartupView
    29 from cubicweb.utils import UStringIO
    29 from cubicweb.utils import UStringIO
    30 from cubicweb.schema import display_name
    30 from cubicweb.schema import display_name
    31 from cubicweb.web import component, formfields as ff, formwidgets as fw
    31 from cubicweb.web import component, formfields as ff, formwidgets as fw
    32 from cubicweb.web.views import forms
    32 from cubicweb.web.views import forms
    82             self.wview('index')
    82             self.wview('index')
    83         else:
    83         else:
    84             self.w(u'<h2>%s</h2>' % msg)
    84             self.w(u'<h2>%s</h2>' % msg)
    85 
    85 
    86 
    86 
    87 @objectify_selector
    87 @objectify_predicate
    88 def templatable_view(cls, req, rset, *args, **kwargs):
    88 def templatable_view(cls, req, rset, *args, **kwargs):
    89     view = kwargs.pop('view', None)
    89     view = kwargs.pop('view', None)
    90     if view is None:
    90     if view is None:
    91         return 1
    91         return 1
    92     if view.binary:
    92     if view.binary: