Revision 87835e94 snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py

b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
650 650
                    func.sum(v.c.size),
651 651
                    func.max(v.c.mtime)])
652 652
        if before != inf:
653
            c1 = select([func.max(self.versions.c.serial)])
654
            c1 = c1.where(self.versions.c.mtime < before)
655
            c1.where(self.versions.c.node == v.c.node)
653
            c1 = select([func.max(self.versions.c.serial)],
654
                        and_(self.versions.c.mtime < before,
655
                             self.versions.c.node == v.c.node))
656 656
        else:
657 657
            c1 = select([self.nodes.c.latest_version])
658 658
            c1 = c1.where(self.nodes.c.node == v.c.node)
......
677 677
                    func.sum(v.c.size),
678 678
                    func.max(v.c.mtime)])
679 679
            c1 = select([func.max(self.versions.c.serial)],
680
                        self.versions.c.node == v.c.node)
681
            c1 = c1.where(self.versions.c.mtime < before)
680
                        and_(self.versions.c.mtime < before,
681
                             self.versions.c.node == v.c.node))
682 682
        else:
683 683
            inner_join = \
684 684
                    self.versions.join(self.nodes, onclause=\
......
703 703
        rp.close()
704 704
        if not r:
705 705
            return None
706
        size = r[1] - props[SIZE]
706
        size = long(r[1] - props[SIZE])
707 707
        mtime = max(mtime, r[2])
708 708
        return (count, size, mtime)
709 709

  
......
991 991
        n = self.nodes.alias('n')
992 992
        s = select([self.attributes.c.key]).distinct()
993 993
        if before != inf:
994
            filtered = select([func.max(self.versions.c.serial)])
995
            filtered = filtered.where(self.versions.c.mtime < before)
996
            filtered = filtered.where(self.versions.c.node == \
997
			    self.versions.c.node)
994
            filtered = select([func.max(self.versions.c.serial)],
995
                              and_(self.versions.c.mtime < before,
996
                                   self.versions.c.node == v.c.node))
998 997
        else:
999 998
            filtered = select([self.nodes.c.latest_version])
1000 999
            filtered = filtered.where(self.nodes.c.node == \
......
1083 1082
        v = self.versions.alias('v')
1084 1083
        n = self.nodes.alias('n')
1085 1084
        if before != inf:
1086
            filtered = select([func.max(self.versions.c.serial)])
1087
            filtered = filtered.where(self.versions.c.mtime < before)
1085
            filtered = select([func.max(self.versions.c.serial)],
1086
                              and_(self.versions.c.mtime < before,
1087
                                   self.versions.c.node == v.c.node))
1088 1088
            inner_join = \
1089 1089
                    self.nodes.join(self.versions,
1090 1090
                            onclause=self.versions.c.serial==filtered)

Also available in: Unified diff