~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

  • Committer: Wouter van Heyst
  • Date: 2006-06-07 11:06:23 UTC
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060607110623-ababc7dc508f613f
StubSFTPServer should use bytestreams rather than unicode

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
        return self.root + self.canonicalize(path)
78
78
 
79
79
    def canonicalize(self, path):
80
 
        path = path.decode('utf-8')
81
80
        if os.path.isabs(path):
82
81
            return os.path.normpath(path)
83
82
        else:
94
93
        path = self._realpath(path)
95
94
        try:
96
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 
97
99
            flist = os.listdir(path)
98
100
            for fname in flist:
99
101
                attr = SFTPAttributes.from_stat(os.stat(pathjoin(path, fname)))
128
130
                fd = os.open(path, flags)
129
131
        except OSError, e:
130
132
            return SFTPServer.convert_errno(e.errno)
 
133
 
131
134
        if (flags & os.O_CREAT) and (attr is not None):
132
135
            attr._flags &= ~attr.FLAG_PERMISSIONS
133
136
            SFTPServer.set_file_attr(path, attr)