diff options
Diffstat (limited to 'src/jarabe/frame/clipboardobject.py')
-rw-r--r-- | src/jarabe/frame/clipboardobject.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/jarabe/frame/clipboardobject.py b/src/jarabe/frame/clipboardobject.py index 90f64e7..407af2f 100644 --- a/src/jarabe/frame/clipboardobject.py +++ b/src/jarabe/frame/clipboardobject.py @@ -106,11 +106,13 @@ class ClipboardObject(object): if format_ == 'text/uri-list': data = self._formats['text/uri-list'].get_data() uri = urlparse.urlparse(mime.split_uri_list(data)[0], 'file') - if uri.scheme == 'file': - if os.path.exists(uri.path): - format_ = mime.get_for_file(uri.path) + scheme = uri.scheme # pylint: disable=E1101 + if scheme == 'file': + path = uri.path # pylint: disable=E1101 + if os.path.exists(path): + format_ = mime.get_for_file(path) else: - format_ = mime.get_from_file_name(uri.path) + format_ = mime.get_from_file_name(path) logging.debug('Chose %r!', format_) return format_ @@ -128,8 +130,9 @@ class Format(object): def destroy(self): if self._on_disk: uri = urlparse.urlparse(self._data) - if os.path.isfile(uri.path): - os.remove(uri.path) + path = uri.path # pylint: disable=E1101 + if os.path.isfile(path): + os.remove(path) def get_type(self): return self._type |