~ubuntu-branches/ubuntu/precise/ubuntuone-client/precise-201201132228

« back to all changes in this revision

Viewing changes to ubuntuone/syncdaemon/filesystem_manager.py

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2011-10-11 14:59:28 UTC
  • Revision ID: james.westby@ubuntu.com-20111011145928-wii0ehii12wmzvv5
Tags: 2.0.0-0ubuntu2
* debian/patches/01_getnodebyid_fix.patch:
  - Fix filter by share and path (LP: #807737)

Show diffs side-by-side

added added

removed removed

Lines of Context:
715
715
                  path, mdobj['mdid'], share_id, node_id)
716
716
 
717
717
    def get_mdobjs_by_share_id(self, share_id, base_path=None):
718
 
        """Returns all the mdobj that belongs to a share and it path
719
 
        startswith base_path.
 
718
        """Get all the mdobjs from a share.
 
719
 
 
720
        If base_path is present, only return those who start with (or
 
721
        are equal to) that path.
720
722
        """
721
723
        if base_path is None:
722
724
            base_path = self._get_share(share_id).path
 
725
        compare_path = base_path + os.path.sep
 
726
 
723
727
        all_mdobjs = []
724
728
        # filter by path first, so we don't touch disk
725
 
        for path in self._idx_path:
726
 
            if path.startswith(base_path):
727
 
                mdid = self._idx_path[path]
 
729
        for path, mdid in self._idx_path.iteritems():
 
730
            if path == base_path or path.startswith(compare_path):
728
731
                mdobj = self.fs[mdid]
729
732
                if mdobj["share_id"] == share_id:
730
733
                    all_mdobjs.append(_MDObject(**mdobj))