diff --git a/__pkginfo__.py b/__pkginfo__.py index 6be9ba4a4f14fe28ce68b2c2787712e428b40e84_X19wa2dpbmZvX18ucHk=..18b619f80a891ab1bd881ca2e438595615970a89_X19wa2dpbmZvX18ucHk= 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -66,5 +66,4 @@ 'Programming Language :: JavaScript', ] -__depends_cubes__ = {} __depends__ = {'cubicweb': '>= 3.7.3'} @@ -70,5 +69,9 @@ __depends__ = {'cubicweb': '>= 3.7.3'} -__use__ = tuple(__depends_cubes__) +__recommends_cubes__ = {'tag': None, + 'comment': '>= 1.6.3'} +__recommends__ = {} +for cube in __recommends_cubes__: + __recommends__['cubicweb-'+cube] = __recommends_cubes__[cube] # package ### diff --git a/debian/control b/debian/control index 6be9ba4a4f14fe28ce68b2c2787712e428b40e84_ZGViaWFuL2NvbnRyb2w=..18b619f80a891ab1bd881ca2e438595615970a89_ZGViaWFuL2NvbnRyb2w= 100644 --- a/debian/control +++ b/debian/control @@ -10,6 +10,7 @@ Package: cubicweb-blog Architecture: all Depends: cubicweb-common (>= 3.7.3) +Suggests: cubicweb-comment (>= 1.6.3), cubicweb-tag Description: blog component for the CubicWeb framework This CubicWeb component provides blogging functionnalities. . diff --git a/views/secondary.py b/views/secondary.py index 6be9ba4a4f14fe28ce68b2c2787712e428b40e84_dmlld3Mvc2Vjb25kYXJ5LnB5..18b619f80a891ab1bd881ca2e438595615970a89_dmlld3Mvc2Vjb25kYXJ5LnB5 100644 --- a/views/secondary.py +++ b/views/secondary.py @@ -161,9 +161,10 @@ _ = lambda ertype, form='': display_name(self._cw, ertype, form) reldata = [] w = reldata.append - if 'comments' in self._cw.vreg.schema and \ - 'BlogEntry' in self._cw.vreg.schema.rschema('comments').objects(): - count = self._cw.execute('Any COUNT(C) WHERE C comments B, B eid %(x)s', - {'x': entity.eid}, 'x')[0][0] + schema = self._cw.vreg.schema + if 'comments' in schema and \ + 'BlogEntry' in schema.rschema('comments').objects(): + from cubes.comment.entities import subcomments_count + count = subcomments_count(entity) if count: url = xml_escape(entity.absolute_url()) @@ -168,5 +169,9 @@ if count: url = xml_escape(entity.absolute_url()) - w(u'<a href="%s">%s %s</a>' % (url, count, _('Comment', 'plural'))) + if count > 1: + label = _('Comment', 'plural') + else: + label = _('Comment') + w(u'<a href="%s">%s %s</a>' % (url, count, label)) else: w(u'%s %s' % (count, _('Comment'))) @@ -171,7 +176,6 @@ else: w(u'%s %s' % (count, _('Comment'))) - if 'tags' in self._cw.vreg.schema and \ - 'BlogEntry' in self._cw.vreg.schema.rschema('tags').objects(): + if 'tags' in schema and 'BlogEntry' in schema.rschema('tags').objects(): tag_rset = entity.related('tags', 'object') if tag_rset: w(u'%s %s' % (_('tags', 'object'), self._cw.view('csv', tag_rset)))