fix iprevnext adapter: sibling of an entry without parent shouldn't have parent as well
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 09 Sep 2010 09:42:15 +0200
changeset 230 f9511e22a124
parent 229 bbc7dce64608
child 233 4dbd994ac6f1
fix iprevnext adapter: sibling of an entry without parent shouldn't have parent as well
views/__init__.py
--- a/views/__init__.py	Thu Sep 09 09:41:44 2010 +0200
+++ b/views/__init__.py	Thu Sep 09 09:42:15 2010 +0200
@@ -24,10 +24,12 @@
                    'WHERE B is BlogEntry, B entry_of BL, BL eid %%(blog)s, '
                    'B eid %s %%(eid)s')
             rset = self._cw.execute(rql % (order, operator),
-                                    {'blog': self.entity.entry_of[0].eid, 'eid': self.entity.eid})
+                                    {'blog': self.entity.entry_of[0].eid,
+                                     'eid': self.entity.eid})
         else:
             rql = ('Any B ORDERBY B %s LIMIT 1 '
-                   'WHERE B is BlogEntry, B eid %s %%(eid)s')
-            rset = self._cw.execute(rql % (order, operator), {'eid': self.entity.eid})
+                   'WHERE B is BlogEntry, B eid %s %%(eid)s, NOT B entry_of BL')
+            rset = self._cw.execute(rql % (order, operator),
+                                    {'eid': self.entity.eid})
         if rset:
             return rset.get_entity(0,0)