~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
        path = self._realpath(path)
94
94
        try:
95
95
            out = [ ]
 
96
            # TODO: win32 incorrectly lists paths with non-ascii if path is not
 
97
            # unicode. However on Linux the server should only deal with
 
98
            # bytestreams and posix.listdir does the right thing 
96
99
            flist = os.listdir(path)
97
100
            for fname in flist:
98
101
                attr = SFTPAttributes.from_stat(os.stat(pathjoin(path, fname)))
127
130
                fd = os.open(path, flags)
128
131
        except OSError, e:
129
132
            return SFTPServer.convert_errno(e.errno)
 
133
 
130
134
        if (flags & os.O_CREAT) and (attr is not None):
131
135
            attr._flags &= ~attr.FLAG_PERMISSIONS
132
136
            SFTPServer.set_file_attr(path, attr)
139
143
            fstr = 'rb'
140
144
        try:
141
145
            f = os.fdopen(fd, fstr)
142
 
        except OSError, e:
 
146
        except (IOError, OSError), e:
143
147
            return SFTPServer.convert_errno(e.errno)
144
148
        fobj = StubSFTPHandle()
145
149
        fobj.filename = path