view.py
branchstable
changeset 8204 332596be995e
parent 8174 b3e87e6865ef
child 8216 99ff746e8de8
child 8419 dd222fcc85d3
equal deleted inserted replaced
8203:e0efa7583221 8204:332596be995e
   194 
   194 
   195         Views applicable on None result sets have to override this method
   195         Views applicable on None result sets have to override this method
   196         """
   196         """
   197         rset = self.cw_rset
   197         rset = self.cw_rset
   198         if rset is None:
   198         if rset is None:
   199             raise NotImplementedError, (self, "an rset is required")
   199             raise NotImplementedError("%r an rset is required" % self)
   200         wrap = self.templatable and len(rset) > 1 and self.add_div_section
   200         wrap = self.templatable and len(rset) > 1 and self.add_div_section
   201         # avoid re-selection if rset of size 1, we already have the most
   201         # avoid re-selection if rset of size 1, we already have the most
   202         # specific view
   202         # specific view
   203         if rset.rowcount != 1:
   203         if rset.rowcount != 1:
   204             kwargs.setdefault('initargs', self.cw_extra_kwargs)
   204             kwargs.setdefault('initargs', self.cw_extra_kwargs)
   216             if wrap:
   216             if wrap:
   217                 self.w(u"</div>")
   217                 self.w(u"</div>")
   218 
   218 
   219     def cell_call(self, row, col, **kwargs):
   219     def cell_call(self, row, col, **kwargs):
   220         """the view is called for a particular result set cell"""
   220         """the view is called for a particular result set cell"""
   221         raise NotImplementedError, self
   221         raise NotImplementedError(repr(self))
   222 
   222 
   223     def linkable(self):
   223     def linkable(self):
   224         """return True if the view may be linked in a menu
   224         """return True if the view may be linked in a menu
   225 
   225 
   226         by default views without title are not meant to be displayed
   226         by default views without title are not meant to be displayed
   377 
   377 
   378     def cell_call(self, row, col, **kwargs):
   378     def cell_call(self, row, col, **kwargs):
   379         self.entity_call(self.cw_rset.get_entity(row, col), **kwargs)
   379         self.entity_call(self.cw_rset.get_entity(row, col), **kwargs)
   380 
   380 
   381     def entity_call(self, entity, **kwargs):
   381     def entity_call(self, entity, **kwargs):
   382         raise NotImplementedError()
   382         raise NotImplementedError('%r %r' % (self.__regid__, self.__class__))
   383 
   383 
   384 
   384 
   385 class StartupView(View):
   385 class StartupView(View):
   386     """base class for views which doesn't need a particular result set to be
   386     """base class for views which doesn't need a particular result set to be
   387     displayed (so they can always be displayed !)
   387     displayed (so they can always be displayed !)