Skip to content
Snippets Groups Projects
Commit 08cad2c92811 authored by Graziella Toutoungis's avatar Graziella Toutoungis
Browse files

add condition to control the visibility of the archive_box

parent 6c1ce3728726
No related branches found
No related tags found
No related merge requests found
......@@ -158,9 +158,10 @@
"""display a list of entities by calling their <item_vid> view
"""
rset = self.req.execute('Any CD ORDERBY CD DESC WHERE B is BlogEntry, B creation_date CD')
blogmonths = []
items = []
for (blogdate,) in rset:
year, month = blogdate.year, blogdate.month
if (year, month) not in blogmonths:
blogmonths.append( (year, month) )
......@@ -161,10 +162,10 @@
blogmonths = []
items = []
for (blogdate,) in rset:
year, month = blogdate.year, blogdate.month
if (year, month) not in blogmonths:
blogmonths.append( (year, month) )
if maxentries is None:
if maxentries is None:
displayed_months = blogmonths
needmore = False
else:
......@@ -193,4 +194,6 @@
def call(self, **kwargs):
"""display blogs archive"""
count_blogentry = self.req.execute('Any B, COUNT(B) GROUPBY B, CD ORDERBY CD DESC '
'WHERE B is BlogEntry, B creation_date CD HAVING COUNT(B) > 0')
_ = self.req._
......@@ -196,7 +199,9 @@
_ = self.req._
box = BoxWidget(_(self.title), id=self.id, islist=False)
box.append(BoxHtml(self.view('blog_archive', None, maxentries=12)))
box.render(self.w)
if count_blogentry:
box = BoxWidget(_(self.title), id=self.id, islist=False)
box.append(BoxHtml(self.view('blog_archive', None, maxentries=12)))
box.render(self.w)
class BlogEntryListBox(BoxTemplate):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment