Revision e8886082 pithos/backends/simple.py

b/pithos/backends/simple.py
217 217
        if version is None:
218 218
            modified = mtime
219 219
        else:
220
            modified = self._get_version(path)[1] # Overall last modification
220
            modified = self._get_version(path, version)[1] # Overall last modification
221 221
        
222 222
        meta = self._get_metadata(path, version_id)
223 223
        meta.update({'name': name, 'bytes': size, 'version': version_id, 'version_timestamp': mtime, 'modified': modified})
......
323 323
        logger.debug("list_versions: %s %s %s", account, container, name)
324 324
        # This will even show deleted versions.
325 325
        path = os.path.join(account, container, name)
326
        sql = '''select distinct version_id, strftime('%s', tstamp) from versions where name = ?'''
326
        sql = '''select distinct version_id, strftime('%s', tstamp) from versions where name = ? and hide = 0'''
327 327
        c = self.con.execute(sql, (path,))
328 328
        return [(int(x[0]), int(x[1])) for x in c.fetchall()]
329 329
    
......
491 491
        sql = '''select name from permissions
492 492
                    where name != ? and (name like ? or ? like name || ?)'''
493 493
        c = self.con.execute(sql, (path, path + '%', path, '%'))
494
        if c.fetchall() is not None:
494
        rows = c.fetchall()
495
        if rows:
495 496
            raise AttributeError('Permissions already set')
496 497
        
497 498
        # Format given permissions set.
498 499
        r = permissions.get('read', [])
499 500
        w = permissions.get('write', [])
500
        if True in [False or '*' in x or ',' in x for x in r]:
501
        if True in [False or ',' in x for x in r]:
501 502
            raise ValueError('Bad characters in read permissions')
502
        if True in [False or '*' in x or ',' in x for x in w]:
503
        if True in [False or ',' in x for x in w]:
503 504
            raise ValueError('Bad characters in write permissions')
504 505
        r = ','.join(r)
505 506
        w = ','.join(w)
506
        if 'public' in permissions:
507
            r = '*'
508 507
        if 'private' in permissions:
509 508
            r = ''
510 509
            w = ''
......
524 523
        if w != '':
525 524
            ret['write'] = w.split(',')
526 525
        if r != '':
527
            if r == '*':
528
                ret['public'] = True
529
            else:
530
                ret['read'] = r.split(',')        
526
            ret['read'] = r.split(',')        
531 527
        return ret
532 528
    
533 529
    def _put_permissions(self, path, r, w):

Also available in: Unified diff