do not display links title when there are no links

This commit is contained in:
Frédéric Péters 2006-10-12 08:54:01 +00:00
parent 3be7cfa9c9
commit e2c667b960
1 changed files with 20 additions and 18 deletions

View File

@ -172,8 +172,10 @@ class AlternateRootDirectory(OldRootDirectory):
'</div>'
def links [html] (self):
## Links
links = Link.select()
if not links:
return
Link.sort_by_position(links)
'<div id="links">'
@ -186,30 +188,30 @@ class AlternateRootDirectory(OldRootDirectory):
def announces [html] (self):
## Announces
announces = Announce.select()
if not announces:
return
announces.sort(lambda x,y: cmp(x.id, y.id))
announces.reverse()
# XXX: sort by date
if announces:
'<div id="announces">'
'<h3>%s</h3>' % _('Announces to citizens')
for item in announces:
'<div class="announce-item">'
'<h4>'
item.title
'</h4>'
'<p>'
item.text
'</p>'
'</div>'
'<p class="subscribe">'
'<a href="announces/subscribe">%s</a>' % _('Receiving those Announces')
'<div id="announces">'
'<h3>%s</h3>' % _('Announces to citizens')
for item in announces:
'<div class="announce-item">'
'<h4>'
item.title
'</h4>'
'<p>'
item.text
'</p>'
'</div>'
'<p class="subscribe">'
'<a href="announces/subscribe">%s</a>' % _('Receiving those Announces')
'</p>'
'</div>'
def page_view [html] (self, filename, title):
get_response().breadcrumb.append((filename, title))
template.html_top(title)