python 2.4 compat
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 28 Jan 2009 13:07:14 +0100
changeset 494 c47229797d0d
parent 493 334df77b38f5
child 495 f8b1edfe9621
child 498 fc7ce5f95dd9
python 2.4 compat
web/views/tabs.py
--- a/web/views/tabs.py	Wed Jan 28 10:30:06 2009 +0100
+++ b/web/views/tabs.py	Wed Jan 28 13:07:14 2009 +0100
@@ -29,7 +29,7 @@
         """
         w = w or self.w
         self.req.add_js('cubicweb.lazy.js')
-        eid = eid if eid else ''
+        eid = eid or ''
         w(u'<div id="lazy-%s" cubicweb__loadurl="%s-%s">' % (vid, vid, eid))
         if show_spinbox:
             w(u'<img src="data/loading.gif" id="%s-hole"/>' % vid)
@@ -62,7 +62,7 @@
             tab = default
         else:
             tab = activetab.value
-        return tab if tab in tabs else default
+        return tab in tabs and tab or default
 
     def prune_tabs(self, tabs):
         selected_tabs = []
@@ -118,7 +118,7 @@
 
     def js_lazily(self, vid_eid):
         vid, eid = vid_eid.split('-')
-        rset = self.req.eid_rset(eid) if eid else None
+        rset = eid and self.req.eid_rset(eid) or None
         view = self.vreg.select_view(vid, self.req, rset)
         return self._set_content_type(view, view.dispatch())