EntityVComponent should now implements cell_call
authorsylvain.thenault@logilab.fr
Fri, 30 Jan 2009 15:26:51 +0100
changeset 529 6e84e93fa7ec
parent 528 60bd171ecd04
child 530 9b56df97ec5f
EntityVComponent should now implements cell_call
web/component.py
--- a/web/component.py	Fri Jan 30 15:26:25 2009 +0100
+++ b/web/component.py	Fri Jan 30 15:26:51 2009 +0100
@@ -56,7 +56,10 @@
     condition = None
     
     def call(self, view):
-        raise RuntimeError()
+        return self.cell_call(0, 0, view)
+
+    def cell_call(self, row, col, view):
+        raise NotImplementedError()
 
     
 class NavigationComponent(VComponent):
@@ -145,17 +148,17 @@
         """
         return None
     
-    def call(self, view=None):
+    def cell_call(self, row, col, view=None):
         rql = self.rql()
         if rql is None:
-            entity = self.rset.get_entity(0, 0)
+            entity = self.rset.get_entity(row, col)
             if self.target == 'object':
                 role = 'subject'
             else:
                 role = 'object'
             rset = entity.related(self.rtype, role)
         else:
-            eid = self.rset[0][0]
+            eid = self.rset[row][col]
             rset = self.req.execute(self.rql(), {'x': eid}, 'x')
         if not rset.rowcount:
             return