~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

Merge in bzrdir work to enable checkout improvements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
            self.home = home[len(self.root):]
69
69
        if (len(self.home) > 0) and (self.home[0] == '/'):
70
70
            self.home = self.home[1:]
 
71
        server._test_case.log('sftpserver - new connection')
71
72
 
72
73
    def _realpath(self, path):
73
74
        return self.root + self.canonicalize(path)
117
118
        try:
118
119
            if hasattr(os, 'O_BINARY'):
119
120
                flags |= os.O_BINARY
120
 
            if (attr is not None) and hasattr(attr, 'st_mode'):
 
121
            if getattr(attr, 'st_mode', None):
121
122
                fd = os.open(path, flags, attr.st_mode)
122
123
            else:
123
124
                fd = os.open(path, flags)
163
164
    def mkdir(self, path, attr):
164
165
        path = self._realpath(path)
165
166
        try:
166
 
            if attr is not None and hasattr(attr, 'st_mode'):
 
167
            # Using getattr() in case st_mode is None or 0
 
168
            # both evaluate to False
 
169
            if getattr(attr, 'st_mode', None):
167
170
                os.mkdir(path, attr.st_mode)
168
171
            else:
169
172
                os.mkdir(path)