git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove py23 compat layer
[sfa.git]
/
sfa
/
trust
/
credential.py
diff --git
a/sfa/trust/credential.py
b/sfa/trust/credential.py
index
307ed95
..
92c114e
100644
(file)
--- a/
sfa/trust/credential.py
+++ b/
sfa/trust/credential.py
@@
-36,7
+36,7
@@
import datetime
from tempfile import mkstemp
from xml.dom.minidom import Document, parseString
from tempfile import mkstemp
from xml.dom.minidom import Document, parseString
-from
sfa.util.py23 import PY3, StringType,
StringIO
+from
io import
StringIO
from xml.parsers.expat import ExpatError
from xml.parsers.expat import ExpatError
@@
-276,7
+276,7
@@
class Credential(object):
self.version = None
if cred:
self.version = None
if cred:
- if isinstance(cred,
StringType
):
+ if isinstance(cred,
str
):
string = cred
self.type = Credential.SFA_CREDENTIAL_TYPE
self.version = '3'
string = cred
self.type = Credential.SFA_CREDENTIAL_TYPE
self.version = '3'
@@
-293,7
+293,7
@@
class Credential(object):
str = infile.read()
# if this is a legacy credential, write error and bail out
str = infile.read()
# if this is a legacy credential, write error and bail out
- if isinstance(str,
StringType
) and str.strip().startswith("-----"):
+ if isinstance(str,
str
) and str.strip().startswith("-----"):
logger.error(
"Legacy credentials not supported any more "
"- giving up with {}..."
logger.error(
"Legacy credentials not supported any more "
"- giving up with {}..."
@@
-639,7
+639,7
@@
class Credential(object):
f = filep
else:
f = open(filename, "w")
f = filep
else:
f = open(filename, "w")
- if
PY3 and
isinstance(self.xml, bytes):
+ if isinstance(self.xml, bytes):
self.xml = self.xml.decode()
f.write(self.xml)
f.close()
self.xml = self.xml.decode()
f.write(self.xml)
f.close()
@@
-647,7
+647,7
@@
class Credential(object):
def save_to_string(self, save_parents=True):
if not self.xml:
self.encode()
def save_to_string(self, save_parents=True):
if not self.xml:
self.encode()
- if
PY3 and
isinstance(self.xml, bytes):
+ if isinstance(self.xml, bytes):
self.xml = self.xml.decode()
return self.xml
self.xml = self.xml.decode()
return self.xml