diff --git a/views.py b/views.py index 4c96b71b1c1b4a6e529b534210e4cac527c47476_dmlld3MucHk=..380ac8079ae3d486f98d448acba6302195aba54f_dmlld3MucHk= 100644 --- a/views.py +++ b/views.py @@ -237,15 +237,6 @@ req = self.req req.add_js( ('cubicweb.ajax.js', 'cubes.comment.js') ) eid = self.rset[0][0] - if orderby == 'author': - rql = u'Any C,CD,CC,CCF,U,UL,US,UF ORDERBY UL WHERE C is Comment, '\ - 'C comments X, C creation_date CD, C content CC, C content_format CCF, ' \ - 'C created_by U, U login UL, U firstname UF, U surname US, X eid %(x)s' - else: # orderby == 'diem' - rql = u'Any C,CD,CC,CCF,U,UL,US,UF ORDERBY CD WHERE C is Comment, '\ - 'C comments X, C creation_date CD, C content CC, C content_format CCF, ' \ - 'C created_by U, U login UL, U firstname UF, U surname US, X eid %(x)s' - rset = req.execute(rql, {'x': eid}, 'x') self.w(u'<div id="%s" class="%s" cubicweb:rooteid="%s">' % ( self.div_id(), self.div_class(), eid)) action = self.vreg.select_action('reply_comment', req, self.rset, row=0) @@ -257,7 +248,19 @@ req.add_js('fckeditor.js') req.fckeditor_config() else: - reply = u'' + reply = u'' + if orderby == 'author': + rql = u'Any C,CD,CC,CCF,U,UL,US,UF ORDERBY UL WHERE C is Comment, '\ + 'C comments X, C creation_date CD, C content CC, C content_format CCF, ' \ + 'C created_by U?, U login UL, U firstname UF, U surname US, X eid %(x)s' + else: # orderby == 'diem' + rql = u'Any C,CD,CC,CCF,U,UL,US,UF ORDERBY CD WHERE C is Comment, '\ + 'C comments X, C creation_date CD, C content CC, C content_format CCF, ' \ + 'C created_by U?, U login UL, U firstname UF, U surname US, X eid %(x)s' + from cubicweb.server import set_debug + set_debug(True) + rset = req.execute(rql, {'x': eid}, 'x') + set_debug(False) if rset.rowcount: self.w(u'<h4>%s</h4>%s' % (req._('Comment_plural'), reply)) self.w(u'<div id="comment%sHolder"></div>' % eid) @@ -265,5 +268,5 @@ for i in xrange(rset.rowcount): self.wview('tree', rset, row=i, full=True) self.w(u'</ul>') - else: + elif reply: self.w(reply) @@ -269,6 +272,5 @@ self.w(reply) - if reply: - self.w(u'<div id="comment%sHolder"></div>' % eid) + self.w(u'<div id="comment%sHolder"></div>' % eid) self.w(u'</div>') baseviews.PRIMARY_SKIP_RELS.add('comments') # displayed by the above component