devtools/test/data/views/bug.py
branchtls-sprint
changeset 1358 a7438eb2420c
parent 0 b97547f5f1fa
child 1977 606923dff11b
equal deleted inserted replaced
1357:e5a97779c7fc 1358:a7438eb2420c
     1 """only for unit tests !"""
     1 """only for unit tests !"""
     2 
     2 
     3 from cubicweb.common.view import EntityView
     3 from cubicweb.view import EntityView
       
     4 from cubicweb.selectors import implements
     4 
     5 
     5 HTML_PAGE = u"""<html>
     6 HTML_PAGE = u"""<html>
     6   <body>
     7   <body>
     7     <h1>Hello World !</h1>
     8     <h1>Hello World !</h1>
     8   </body>
     9   </body>
     9 </html>
    10 </html>
    10 """
    11 """
    11 
    12 
    12 class SimpleView(EntityView):
    13 class SimpleView(EntityView):
    13     id = 'simple'
    14     id = 'simple'
    14     accepts = ('Bug',)
    15     __select__ = implements('Bug',)
    15 
    16 
    16     def call(self, **kwargs):
    17     def call(self, **kwargs):
    17         self.cell_call(0, 0)
    18         self.cell_call(0, 0)
    18 
    19 
    19     def cell_call(self, row, col):
    20     def cell_call(self, row, col):
    20         self.w(HTML_PAGE)
    21         self.w(HTML_PAGE)
    21 
    22 
    22 class RaisingView(EntityView):
    23 class RaisingView(EntityView):
    23     id = 'raising'
    24     id = 'raising'
    24     accepts = ('Bug',)
    25     __select__ = implements('Bug',)
    25 
    26 
    26     def cell_call(self, row, col):
    27     def cell_call(self, row, col):
    27         raise ValueError()
    28         raise ValueError()