- Add patch to work properly with py2:
* python2.patch - Update to 0.9.12: * No upstream chagelog provided - Remove merged fix_python2_urllib.patch - Sort with spec-cleaner OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PyWebDAV3?expand=0&rev=7
This commit is contained in:
committed by
Git OBS Bridge
parent
b7f508d8af
commit
1695dcb6df
40
python2.patch
Normal file
40
python2.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From 5d7d16a4e417c9483d8ff529835498f336c6cc37 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Leech <andrew@alelec.net>
|
||||
Date: Mon, 23 Apr 2018 10:12:16 +1000
|
||||
Subject: [PATCH] Fix python2 support
|
||||
|
||||
---
|
||||
pywebdav/server/fshandler.py | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pywebdav/server/fshandler.py b/pywebdav/server/fshandler.py
|
||||
index 84bb333..7b9b0a6 100644
|
||||
--- a/pywebdav/server/fshandler.py
|
||||
+++ b/pywebdav/server/fshandler.py
|
||||
@@ -1,6 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
-import html
|
||||
import textwrap
|
||||
import six
|
||||
import logging
|
||||
@@ -12,6 +11,10 @@
|
||||
from pywebdav.lib.errors import *
|
||||
from pywebdav.lib.iface import *
|
||||
from pywebdav.lib.davcmd import copyone, copytree, moveone, movetree, delone, deltree
|
||||
+if six.PY2:
|
||||
+ from cgi import escape
|
||||
+else:
|
||||
+ from html import escape
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -142,7 +145,7 @@ def _get_listing(self, path):
|
||||
</body>
|
||||
</html>
|
||||
""")
|
||||
- escapeditems = (html.escape(i) + ('/' if os.path.isdir(os.path.join(path, i)) else '') for i in os.listdir(path) if not i.startswith('.'))
|
||||
+ escapeditems = (escape(i) + ('/' if os.path.isdir(os.path.join(path, i)) else '') for i in os.listdir(path) if not i.startswith('.'))
|
||||
htmlitems = "\n".join('<li><a href="{i}">{i}</a></li>'.format(i=i) for i in escapeditems)
|
||||
|
||||
return template.format(items=htmlitems, path=path)
|
||||
Reference in New Issue
Block a user