--- a/cwvreg.py Thu Aug 13 09:59:35 2009 +0200
+++ b/cwvreg.py Thu Aug 13 10:02:18 2009 +0200
@@ -68,6 +68,7 @@
obj = self.select(__fallback_oid, req, **kwargs)
return obj.render(**kwargs)
+ @deprecated('[3.5] use select_or_none and test for obj.propval("visible")')
def select_vobject(self, oid, *args, **kwargs):
selected = self.select_or_none(oid, *args, **kwargs)
if selected and selected.propval('visible'):
--- a/web/views/basetemplates.py Thu Aug 13 09:59:35 2009 +0200
+++ b/web/views/basetemplates.py Thu Aug 13 10:02:18 2009 +0200
@@ -113,9 +113,9 @@
if vtitle:
w(u'<h1 class="vtitle">%s</h1>\n' % xml_escape(vtitle))
# display entity type restriction component
- etypefilter = self.vreg['components'].select_vobject(
+ etypefilter = self.vreg['components'].select_or_none(
'etypenavigation', self.req, rset=self.rset)
- if etypefilter:
+ if etypefilter and etypefilter.propval('visible'):
etypefilter.render(w=w)
self.nav_html = UStringIO()
if view and view.need_navigation:
@@ -256,9 +256,9 @@
w(u'<h1 class="vtitle">%s</h1>' % xml_escape(vtitle))
def topleft_header(self):
- logo = self.vreg['components'].select_vobject('logo', self.req,
+ logo = self.vreg['components'].select_or_none('logo', self.req,
rset=self.rset)
- if logo:
+ if logo and logo.propval('visible'):
self.w(u'<table id="header"><tr>\n')
self.w(u'<td>')
logo.render(w=self.w)
@@ -328,29 +328,29 @@
"""build the top menu with authentification info and the rql box"""
self.w(u'<table id="header"><tr>\n')
self.w(u'<td id="firstcolumn">')
- logo = self.vreg['components'].select_vobject(
+ logo = self.vreg['components'].select_or_none(
'logo', self.req, rset=self.rset)
- if logo:
+ if logo and logo.propval('visible'):
logo.render(w=self.w)
self.w(u'</td>\n')
# appliname and breadcrumbs
self.w(u'<td id="headtext">')
for cid in ('appliname', 'breadcrumbs'):
- comp = self.vreg['components'].select_vobject(
+ comp = self.vreg['components'].select_or_none(
cid, self.req, rset=self.rset)
- if comp:
+ if comp and comp.propval('visible'):
comp.render(w=self.w)
self.w(u'</td>')
# logged user and help
self.w(u'<td>\n')
- comp = self.vreg['components'].select_vobject(
+ comp = self.vreg['components'].select_or_none(
'loggeduserlink', self.req, rset=self.rset)
- if comp:
+ if comp and comp.propval('visible'):
comp.render(w=self.w)
self.w(u'</td><td>')
- helpcomp = self.vreg['components'].select_vobject(
+ helpcomp = self.vreg['components'].select_or_none(
'help', self.req, rset=self.rset)
- if helpcomp:
+ if helpcomp and helpcomp.propval('visible'):
helpcomp.render(w=self.w)
self.w(u'</td>')
# lastcolumn