~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-23 22:30:55 UTC
  • mfrom: (1185.50.51 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1551.
  • Revision ID: john@arbash-meinel.com-20060123223055-43e99c932f0c8945
[merge] 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)