diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2018-01-23 16:08:15 +0300 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2018-01-23 16:08:15 +0300 |
commit | 72b9beb79c09c41ee08d6a032241e27579d32c88 (patch) | |
tree | 1cd0d40770bd8bda640cbdc8e7e779251c59c884 /shell_integration | |
parent | 883080b55786ac21cbac973ee381ebc3d08f58aa (diff) | |
parent | 72363155d86b4b51b1bfbd75c7a4a19fed3f8ee9 (diff) |
Merge remote-tracking branch 'origin/2.4'
Conflicts:
shell_integration/nautilus/syncstate.py
Diffstat (limited to 'shell_integration')
-rw-r--r-- | shell_integration/nautilus/syncstate.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py index 067c6a40a..6253c07e4 100644 --- a/shell_integration/nautilus/syncstate.py +++ b/shell_integration/nautilus/syncstate.py @@ -15,8 +15,13 @@ # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. +import sys +python3 = sys.version_info[0] >= 3 + import os import urllib +if python3: + import urllib.parse import socket import tempfile import time @@ -31,11 +36,11 @@ appname = 'ownCloud' print("Initializing "+appname+"-client-nautilus extension") - def get_local_path(url): if url[0:7] == 'file://': url = url[7:] - return urllib.unquote(url) + unquote = urllib.parse.unquote if python3 else urllib.unquote + return unquote(url) def get_runtime_dir(): """Returns the value of $XDG_RUNTIME_DIR, a directory path. @@ -57,7 +62,7 @@ class SocketConnect(GObject.GObject): self._watch_id = 0 self._sock = None self._listeners = [self._update_registered_paths, self._get_version] - self._remainder = '' + self._remainder = ''.encode() self.protocolVersion = '1.0' self.nautilusVFSFile_table = {} # not needed in this object actually but shared # all over the other objects. @@ -76,7 +81,7 @@ class SocketConnect(GObject.GObject): # print("Server command: " + cmd) if self.connected: try: - self._sock.send(cmd) + self._sock.send(cmd.encode()) except: print("Sending failed.") self.reconnect() @@ -126,12 +131,12 @@ class SocketConnect(GObject.GObject): # Parses response lines out of collected data, returns list of strings def get_available_responses(self): - end = self._remainder.rfind('\n') + end = self._remainder.rfind('\n'.encode()) if end == -1: return [] data = self._remainder[:end] self._remainder = self._remainder[end+1:] - return data.split('\n') + return data.decode().split('\n') # Notify is the raw answer from the socket def _handle_notify(self, source, condition): |