~bmerry/duplicity/pydrive-regular

« back to all changes in this revision

Viewing changes to duplicity/backends/localbackend.py

  • Committer: Michael Terry
  • Date: 2014-04-17 20:50:57 UTC
  • mto: This revision was merged to the branch mainline in revision 975.
  • Revision ID: michael.terry@canonical.com-20140417205057-4cxo1yebh0oer02a
Solve except 2to3 fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
                source_path.rename(target_path)
75
75
            except OSError:
76
76
                pass
77
 
            except Exception, e:
 
77
            except Exception as e:
78
78
                self.handle_error(e, 'put', source_path.name, target_path.name)
79
79
            else:
80
80
                return
81
81
        try:
82
82
            target_path.writefileobj(source_path.open("rb"))
83
 
        except Exception, e:
 
83
        except Exception as e:
84
84
            self.handle_error(e, 'put', source_path.name, target_path.name)
85
85
 
86
86
        """If we get here, renaming failed previously"""
93
93
        source_path = self.remote_pathdir.append(filename)
94
94
        try:
95
95
            local_path.writefileobj(source_path.open("rb"))
96
 
        except Exception, e:
 
96
        except Exception as e:
97
97
            self.handle_error(e, 'get', source_path.name, local_path.name)
98
98
 
99
99
    def _list(self):
104
104
                pass
105
105
        try:
106
106
            return self.remote_pathdir.listdir()
107
 
        except Exception, e:
 
107
        except Exception as e:
108
108
            self.handle_error(e, 'list', self.remote_pathdir.name)
109
109
 
110
110
    def delete(self, filename_list):
113
113
        for filename in filename_list:
114
114
            try:
115
115
                self.remote_pathdir.append(filename).delete()
116
 
            except Exception, e:
 
116
            except Exception as e:
117
117
                self.handle_error(e, 'delete', self.remote_pathdir.append(filename).name)
118
118
 
119
119
    def _query_file_info(self, filename):
125
125
            target_file.setdata()
126
126
            size = target_file.getsize()
127
127
            return {'size': size}
128
 
        except Exception, e:
 
128
        except Exception as e:
129
129
            self.handle_error(e, 'query', target_file.name)
130
130
            return {'size': None}
131
131