~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-16 08:02:54 UTC
  • mfrom: (2414.1.3 hpss-miscellany-2)
  • Revision ID: pqm@pqm.ubuntu.com-20070416080254-bf3rfk77k5bgfdl7
(Andrew Bennetts) Add some unicode-related tests from the hpss branch, and a few other nits (also from the hpss branch).

Show diffs side-by-side

added added

removed removed

Lines of Context:
618
618
        :param mode: Create the file with the given mode.
619
619
        :return: None
620
620
        """
621
 
        assert isinstance(bytes, str), \
622
 
            'bytes must be a plain string, not %s' % type(bytes)
 
621
        if not isinstance(bytes, str):
 
622
            raise AssertionError(
 
623
                'bytes must be a plain string, not %s' % type(bytes))
623
624
        return self.put_file(relpath, StringIO(bytes), mode=mode)
624
625
 
625
626
    def put_bytes_non_atomic(self, relpath, bytes, mode=None,
640
641
                        create it, and then try again.
641
642
        :param dir_mode: Possible access permissions for new directories.
642
643
        """
643
 
        assert isinstance(bytes, str), \
644
 
            'bytes must be a plain string, not %s' % type(bytes)
 
644
        if not isinstance(bytes, str):
 
645
            raise AssertionError(
 
646
                'bytes must be a plain string, not %s' % type(bytes))
645
647
        self.put_file_non_atomic(relpath, StringIO(bytes), mode=mode,
646
648
                                 create_parent_dir=create_parent_dir,
647
649
                                 dir_mode=dir_mode)
1243
1245
register_lazy_transport('ftp://', 'bzrlib.transport.ftp', 'FtpTransport')
1244
1246
register_lazy_transport('aftp://', 'bzrlib.transport.ftp', 'FtpTransport')
1245
1247
register_lazy_transport('memory://', 'bzrlib.transport.memory', 'MemoryTransport')
1246
 
register_lazy_transport('chroot+', 'bzrlib.transport.chroot',
1247
 
                        'ChrootTransportDecorator')
1248
1248
register_lazy_transport('readonly+', 'bzrlib.transport.readonly', 'ReadonlyTransportDecorator')
1249
1249
register_lazy_transport('fakenfs+', 'bzrlib.transport.fakenfs', 'FakeNFSTransportDecorator')
1250
1250
register_lazy_transport('vfat+',