devtools/test/data/views.py
changeset 5877 0c7b7b76a84f
parent 5424 8ecbcbff9777
child 8190 2a3c1b787688
equal deleted inserted replaced
5876:e77aa963fb19 5877:0c7b7b76a84f
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    14 # details.
    14 # details.
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """only for unit tests !
    18 """only for unit tests !"""
    19 
       
    20 """
       
    21 
    19 
    22 from cubicweb.view import EntityView
    20 from cubicweb.view import EntityView
    23 from cubicweb.selectors import implements
    21 from cubicweb.selectors import is_instance
    24 
    22 
    25 HTML_PAGE = u"""<html>
    23 HTML_PAGE = u"""<html>
    26   <body>
    24   <body>
    27     <h1>Hello World !</h1>
    25     <h1>Hello World !</h1>
    28   </body>
    26   </body>
    29 </html>
    27 </html>
    30 """
    28 """
    31 
    29 
    32 class SimpleView(EntityView):
    30 class SimpleView(EntityView):
    33     __regid__ = 'simple'
    31     __regid__ = 'simple'
    34     __select__ = implements('Bug',)
    32     __select__ = is_instance('Bug',)
    35 
    33 
    36     def call(self, **kwargs):
    34     def call(self, **kwargs):
    37         self.cell_call(0, 0)
    35         self.cell_call(0, 0)
    38 
    36 
    39     def cell_call(self, row, col):
    37     def cell_call(self, row, col):
    40         self.w(HTML_PAGE)
    38         self.w(HTML_PAGE)
    41 
    39 
    42 class RaisingView(EntityView):
    40 class RaisingView(EntityView):
    43     __regid__ = 'raising'
    41     __regid__ = 'raising'
    44     __select__ = implements('Bug',)
    42     __select__ = is_instance('Bug',)
    45 
    43 
    46     def cell_call(self, row, col):
    44     def cell_call(self, row, col):
    47         raise ValueError()
    45         raise ValueError()