Revision ace7592b

b/snf-pithos-backend/pithos/backends/modular.py
209 209
                  'MATCH_PREFIX', 'MATCH_EXACT']:
210 210
            setattr(self, x, getattr(self.db_module, x))
211 211

  
212
        self.ALLOWED =  ['read','write']
212
        self.ALLOWED = ['read', 'write']
213 213

  
214 214
        self.block_module = load_module(block_module)
215 215
        self.block_params = block_params
......
876 876
        from which the object gets its permissions from,
877 877
        along with a dictionary containing the permissions."""
878 878

  
879
        permissions_path = self._get_permissions_path_bulk(account,
880
                container,names)
879
        permissions_path = self._get_permissions_path_bulk(account, container,
880
                                                           names)
881 881
        access_objects = self.permissions.access_check_bulk(permissions_path,
882
                user)
882
                                                            user)
883 883
        #group_parents = access_objects['group_parents']
884 884
        nobject_permissions = {}
885 885
        for path in permissions_path:
......
897 897
        self._lookup_objects(permissions_path)
898 898
        return nobject_permissions
899 899

  
900

  
901 900
    @debug_method
902 901
    def get_object_permissions(self, user, account, container, name):
903 902
        """Return the action allowed on the object, the path
......
1660 1659
        # raise ValueError('Bad characters in permissions')
1661 1660
        pass
1662 1661

  
1663

  
1664 1662
    def _get_formatted_paths(self, paths):
1665 1663
        formatted = []
1666
        if len(paths) == 0 :
1664
        if len(paths) == 0:
1667 1665
            return formatted
1668 1666
        props = self.node.get_props(paths)
1669 1667
        if props:
1670 1668
            for prop in props:
1671 1669
                if prop[1].split(';', 1)[0].strip() in (
1672 1670
                        'application/directory', 'application/folder'):
1673
                    formatted.append((prop[0].rstrip('/') + '/', self.MATCH_PREFIX))
1671
                    formatted.append((prop[0].rstrip('/') + '/',
1672
                                      self.MATCH_PREFIX))
1674 1673
                formatted.append((prop[0], self.MATCH_EXACT))
1675 1674
        return formatted
1676 1675

  
......
1690 1689
                if node is not None:
1691 1690
                    props = self.node.version_lookup(node, inf, CLUSTER_NORMAL)
1692 1691
                if props is not None:
1693
                    if props[self.TYPE].split(';', 1)[0].strip() in ('application/directory', 'application/folder'):
1692
                    if props[self.TYPE].split(';', 1)[0].strip() in (
1693
                            'application/directory', 'application/folder'):
1694 1694
                        return p
1695 1695
        return None
1696 1696

  
......
1699 1699
        for name in names:
1700 1700
            path = '/'.join((account, container, name))
1701 1701
            formatted_paths.append(path)
1702
        permission_paths = self.permissions.access_inherit_bulk(formatted_paths)
1702
        permission_paths = self.permissions.access_inherit_bulk(
1703
            formatted_paths)
1703 1704
        permission_paths.sort()
1704 1705
        permission_paths.reverse()
1705 1706
        permission_paths_list = []
......
1718 1719
                for prop in props:
1719 1720
                    if prop[1].split(';', 1)[0].strip() in (
1720 1721
                            'application/directory', 'application/folder'):
1721
                        permission_paths_list.append((prop[0].rstrip('/') + '/',self.MATCH_PREFIX))
1722
                        permission_paths_list.append((
1723
                            prop[0].rstrip('/') + '/', self.MATCH_PREFIX))
1722 1724

  
1723 1725
        if len(permission_paths_list) > 0:
1724 1726
            return permission_paths_list

Also available in: Unified diff