~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

MergeĀ fromĀ jam-integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
        try:
118
118
            if hasattr(os, 'O_BINARY'):
119
119
                flags |= os.O_BINARY
120
 
            if (attr is not None) and hasattr(attr, 'st_mode'):
 
120
            if getattr(attr, 'st_mode', None):
121
121
                fd = os.open(path, flags, attr.st_mode)
122
122
            else:
123
123
                fd = os.open(path, flags)
163
163
    def mkdir(self, path, attr):
164
164
        path = self._realpath(path)
165
165
        try:
166
 
            if attr is not None and hasattr(attr, 'st_mode'):
 
166
            # Using getattr() in case st_mode is None or 0
 
167
            # both evaluate to False
 
168
            if getattr(attr, 'st_mode', None):
167
169
                os.mkdir(path, attr.st_mode)
168
170
            else:
169
171
                os.mkdir(path)