From fb784c28c4ba31187f0180985ea5967b12b438c3 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Sun, 27 Oct 2013 21:43:36 +0100 Subject: [PATCH] Fix python 3 problem: 'str' does not support the buffer interface --- radicale/rights.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/radicale/rights.py b/radicale/rights.py index 7f741a1..d0743b5 100644 --- a/radicale/rights.py +++ b/radicale/rights.py @@ -36,7 +36,6 @@ Leading or ending slashes are trimmed from collection's path. """ import re -import io import os.path from . import config, log @@ -47,6 +46,11 @@ try: from configparser import ConfigParser except ImportError: from ConfigParser import ConfigParser + +try: + from StringIO import StringIO +except ImportError: + from io import StringIO # pylint: enable=F0401 @@ -63,7 +67,7 @@ def _read_from_sections(user, collection, permission): regex = ConfigParser({"login": user, "path": collection}) if rights_type in DEFINED_RIGHTS: log.LOGGER.debug("Rights type '%s'" % rights_type) - regex.readfp(io.BytesIO(DEFINED_RIGHTS[rights_type])) + regex.readfp(StringIO(DEFINED_RIGHTS[rights_type])) elif rights_type == "from_file": log.LOGGER.debug("Reading rights from file %s" % filename) if not regex.read(filename):