Skip to content

Commit

Permalink
removed deprecated _str function as py2 support has been dropped
Browse files Browse the repository at this point in the history
update _str references to use builin str instead
update settings.Preferences class for py2 drop
  • Loading branch information
blacktwin committed Jul 28, 2020
1 parent 337ad9d commit 5045ddc
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions plexapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,11 @@ class Setting(PlexObject):
"""
_bool_cast = lambda x: True if x == 'true' or x == '1' else False
_bool_str = lambda x: str(x).lower()
_str = lambda x: str(x).encode('utf-8')
TYPES = {
'bool': {'type': bool, 'cast': _bool_cast, 'tostr': _bool_str},
'double': {'type': float, 'cast': float, 'tostr': _str},
'int': {'type': int, 'cast': int, 'tostr': _str},
'text': {'type': str, 'cast': _str, 'tostr': _str},
'double': {'type': float, 'cast': float, 'tostr': str},
'int': {'type': int, 'cast': int, 'tostr': str},
'text': {'type': str, 'cast': str, 'tostr': str},
}

def _loadData(self, data):
Expand Down Expand Up @@ -171,8 +170,5 @@ class Preferences(Setting):
def _default(self):
""" Set the default value for this setting."""
key = '%s/prefs?' % self._initpath
if self.type == 'int':
url = key + '%s=%s' % (self.id, self.default)
else:
url = key + '%s=%s' % (self.id, self.default.decode())
url = key + '%s=%s' % (self.id, self.default)
self._server.query(url, method=self._server._session.put)

0 comments on commit 5045ddc

Please sign in to comment.