py3: raise exceptions using six module

There is no other way to make Python2 and Python3 happy, because syntax
raise E, V, T is incompatible with the latter.

Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Łukasz Żarnowiecki
2016-05-17 19:56:52 +02:00
committed by Nicolas Sebrecht
parent 83539f8601
commit 0addcbabf0
13 changed files with 70 additions and 49 deletions

View File

@ -18,6 +18,8 @@ import os
import re
from sys import exc_info
import six
try:
from ConfigParser import SafeConfigParser, Error
except ImportError: #python3
@ -75,8 +77,8 @@ class CustomConfigParser(SafeConfigParser):
val = self.get(section, option).strip()
return re.split(separator_re, val)
except re.error as e:
raise Error("Bad split regexp '%s': %s" % \
(separator_re, e)), None, exc_info()[2]
six.reraise(Error("Bad split regexp '%s': %s" % \
(separator_re, e)), None, exc_info()[2])
def getdefaultlist(self, section, option, default, separator_re):
"""Same as getlist, but returns the value of `default`