allow to override is_primary result using an argument given to object constructor (have to be given to 'initargs' argument of .render like initargs={'is_primary': False} stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 02 Dec 2009 16:56:28 +0100
branchstable
changeset 3973 1c09d2fd38c5
parent 3972 ec3d294034bf
child 3974 1d36d9904c41
allow to override is_primary result using an argument given to object constructor (have to be given to 'initargs' argument of .render like initargs={'is_primary': False}
view.py
--- a/view.py	Wed Dec 02 15:08:11 2009 +0100
+++ b/view.py	Wed Dec 02 16:56:28 2009 +0100
@@ -168,6 +168,7 @@
         if rset is None:
             raise NotImplementedError, self
         wrap = self.templatable and len(rset) > 1 and self.add_div_section
+        # XXX propagate self.extra_kwars?
         for i in xrange(len(rset)):
             if wrap:
                 self.w(u'<div class="section">')
@@ -189,7 +190,7 @@
         return True
 
     def is_primary(self):
-        return self.id == 'primary'
+        return self.extra_kwargs.get('is_primary', self.id == 'primary')
 
     def url(self):
         """return the url associated with this view. Should not be