Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kamm <mail@ckamm.de>2018-01-23 13:47:23 +0300
committerOlivier Goffart <ogoffart@woboq.com>2018-01-23 14:30:58 +0300
commit72363155d86b4b51b1bfbd75c7a4a19fed3f8ee9 (patch)
treea9db32de4477d7d9a2849a27df87e8a5f734bba3 /shell_integration
parentf254ee3211d18af79ed5c2fd1fa87c23658c7b6b (diff)
Nautilus integration: Work with python2 and python3
Diffstat (limited to 'shell_integration')
-rw-r--r--shell_integration/nautilus/syncstate.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py
index 6ea719100..77a233d3d 100644
--- a/shell_integration/nautilus/syncstate.py
+++ b/shell_integration/nautilus/syncstate.py
@@ -15,9 +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
-import urllib.parse
+if python3:
+ import urllib.parse
import socket
import tempfile
@@ -31,11 +35,11 @@ appname = 'ownCloud'
print("Initializing "+appname+"-client-nautilus extension")
-
def get_local_path(url):
if url[0:7] == 'file://':
url = url[7:]
- return urllib.parse.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.