~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

  • Committer: John Arbash Meinel
  • Date: 2006-01-19 20:36:09 UTC
  • mto: (1185.50.49 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1549.
  • Revision ID: john@arbash-meinel.com-20060119203609-c72700dcc1c4fc9d
Bugfix to allow using paramiko > 1.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
        try:
106
106
            if hasattr(os, 'O_BINARY'):
107
107
                flags |= os.O_BINARY
108
 
            if (attr is not None) and hasattr(attr, 'st_mode'):
 
108
            if (attr is not None) and getattr(attr, 'st_mode', None):
109
109
                fd = os.open(path, flags, attr.st_mode)
110
110
            else:
111
111
                fd = os.open(path, flags)
151
151
    def mkdir(self, path, attr):
152
152
        path = self._realpath(path)
153
153
        try:
154
 
            if attr is not None and hasattr(attr, 'st_mode'):
 
154
            # Using getattr() in case st_mode is None or 0
 
155
            # both evaluate to False
 
156
            if attr is not None and getattr(attr, 'st_mode', None):
155
157
                os.mkdir(path, attr.st_mode)
156
158
            else:
157
159
                os.mkdir(path)