~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Vincent Ladeuil
  • Date: 2010-08-28 16:56:36 UTC
  • mto: (5345.5.13 lockable-config-files)
  • mto: This revision was merged to the branch mainline in revision 5395.
  • Revision ID: v.ladeuil+lp@free.fr-20100828165636-8e2wziacdpog1adg
Rename IniBaseConfig.from_bytes to from_string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
377
377
        self._parser = None
378
378
 
379
379
    @classmethod
380
 
    def from_bytes(cls, unicode_bytes):
 
380
    def from_string(cls, str_or_unicode):
381
381
        """Create a config object from bytes.
382
382
 
383
 
        :param unicode_bytes: A string representing the file content. This will
 
383
        :param str_or_unicode: A string representing the file content. This will
384
384
            be utf-8 encoded.
385
385
        """
386
386
        conf = cls()
387
 
        conf._content = StringIO(unicode_bytes.encode('utf-8'))
 
387
        conf._content = StringIO(str_or_unicode.encode('utf-8'))
388
388
        return conf
389
389
 
390
390
    def _get_parser(self, file=symbol_versioning.DEPRECATED_PARAMETER):
581
581
        self.location = location
582
582
 
583
583
    @classmethod
584
 
    def from_bytes(cls, unicode_bytes, location):
 
584
    def from_string(cls, str_or_unicode, location):
585
585
        """Create a config object from bytes.
586
586
 
587
 
        :param unicode_bytes: A string representing the file content. This will
 
587
        :param str_or_unicode: A string representing the file content. This will
588
588
            be utf-8 encoded.
589
589
 
590
590
        :param location: The location url to filter the configuration.
591
591
        """
592
592
        conf = cls(location)
593
 
        conf._content = StringIO(unicode_bytes.encode('utf-8'))
 
593
        conf._content = StringIO(str_or_unicode.encode('utf-8'))
594
594
        return conf
595
595
 
596
596
    def _get_matching_sections(self):