Skip to content

Commit c9115c2

Browse files
committed
Simplify unicode storage with QuotedConfigParser.
Do not use type prefix with setquoted, getquoted functions. This lets the configuration file work with older PDFgui-s provided it has no Unicode paths.
1 parent 15b0245 commit c9115c2

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

diffpy/pdfgui/utils.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,7 @@ def getquoted(self, section, option):
6767
This allows to work with unicode strings.
6868
"""
6969
vq = self.get(section, option)
70-
if vq.startswith('u '):
71-
rv = vq[2:].decode('utf8')
72-
elif vq.startswith('s '):
73-
rv = vq[2:]
74-
else:
75-
rv = vq
70+
rv = vq.decode('utf8')
7671
return rv
7772

7873

@@ -82,10 +77,7 @@ def setquoted(self, section, option, value):
8277
This allows to store and write out unicode strings.
8378
Use getquoted to recover the decoded value.
8479
"""
85-
if isinstance(value, unicode):
86-
vq = 'u ' + value.encode('utf8')
87-
else:
88-
vq = 's ' + value
80+
vq = value.encode('utf8')
8981
return self.set(section, option, vq)
9082

9183
# class QuotedConfigParser

0 commit comments

Comments
 (0)