~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

merge in trunk and i18n-errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
1397
1397
            return (self.branch._transport.get_bytes("email")
1398
1398
                    .decode(osutils.get_user_encoding())
1399
1399
                    .rstrip("\r\n"))
1400
 
        except errors.NoSuchFile, e:
 
1400
        except (errors.NoSuchFile, errors.PermissionDenied), e:
1401
1401
            pass
1402
1402
 
1403
1403
        return self._get_best_value('_get_user_id')
2278
2278
            return f
2279
2279
        except errors.NoSuchFile:
2280
2280
            return StringIO()
 
2281
        except errors.PermissionDenied, e:
 
2282
            trace.warning("Permission denied while trying to open "
 
2283
                "configuration file %s.", urlutils.unescape_for_display(
 
2284
                urlutils.join(self._transport.base, self._filename), "utf-8"))
 
2285
            return StringIO()
2281
2286
 
2282
2287
    def _external_url(self):
2283
2288
        return urlutils.join(self._transport.external_url(), self._filename)
2690
2695
        """Load the store from the associated file."""
2691
2696
        if self.is_loaded():
2692
2697
            return
2693
 
        content = self.transport.get_bytes(self.file_name)
 
2698
        try:
 
2699
            content = self.transport.get_bytes(self.file_name)
 
2700
        except errors.PermissionDenied:
 
2701
            trace.warning("Permission denied while trying to load "
 
2702
                          "configuration store %s.", self.external_url())
 
2703
            raise
2694
2704
        self._load_from_string(content)
2695
2705
        for hook in ConfigHooks['load']:
2696
2706
            hook(self)
2738
2748
        # We need a loaded store
2739
2749
        try:
2740
2750
            self.load()
2741
 
        except errors.NoSuchFile:
2742
 
            # If the file doesn't exist, there is no sections
 
2751
        except (errors.NoSuchFile, errors.PermissionDenied):
 
2752
            # If the file can't be read, there is no sections
2743
2753
            return
2744
2754
        cobj = self._config_obj
2745
2755
        if cobj.scalars: